casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Pressure.h
Go to the documentation of this file.
1 //Pressure.h generated on 'Thu Feb 04 10:20:05 CET 2010'. Edit at your own risk.
2 /*
3  * ALMA - Atacama Large Millimeter Array
4  * (c) European Southern Observatory, 2002
5  * (c) Associated Universities Inc., 2002
6  * Copyright by ESO (in the framework of the ALMA collaboration),
7  * Copyright by AUI (in the framework of the ALMA collaboration),
8  * All rights reserved.
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY, without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23  * MA 02111-1307 USA
24  *
25  * File Pressure.h
26  */
27 #ifndef Pressure_CLASS
28 #define Pressure_CLASS
29 #include <vector>
30 #include <iostream>
31 #include <string>
32 #ifndef WITHOUT_ACS
33 #include <asdmIDLTypesC.h>
34 #endif
37 #include <alma/ASDM/EndianStream.h>
38 namespace asdm {
39 class Pressure;
40 Pressure operator * ( double , const Pressure & );
41 std::ostream & operator << ( std::ostream &, const Pressure & );
42 std::istream & operator >> ( std::istream &, Pressure &);
53 class Pressure {
60  friend Pressure operator * ( double d, const Pressure & x );
66  friend std::ostream & operator << ( std::ostream & os, const Pressure & x);
70  friend std::istream & operator >> ( std::istream & is, Pressure & x);
71 public:
75  Pressure();
79  Pressure(const Pressure &);
87  Pressure(const std::string &s);
88 #ifndef WITHOUT_ACS
89 
95  Pressure(const asdmIDLTypes::IDLPressure & idlPressure);
96 #endif
97 
101  Pressure(double value);
105  virtual ~Pressure();
110  static double fromString(const std::string& s);
117  static std::string toString(double);
124 
129  void toBin(EndianOSStream& eoss);
135  static void toBin(const std::vector<Pressure>& angle, EndianOSStream& eoss);
136 
142  static void toBin(const std::vector<std::vector<Pressure> >& angle, EndianOSStream& eoss);
143 
149  static void toBin(const std::vector<std::vector<std::vector<Pressure> > >& angle, EndianOSStream& eoss);
156  static Pressure fromBin(EndianIStream& eis);
157 
164  static std::vector<Pressure> from1DBin(EndianIStream & eis);
165 
172  static std::vector<std::vector<Pressure> > from2DBin(EndianIStream & eis);
173 
180  static std::vector<std::vector<std::vector<Pressure> > > from3DBin(EndianIStream & eis);
181 
186  Pressure & operator = (const Pressure & x);
187 
192  Pressure & operator = (const double d);
197  Pressure & operator += (const Pressure & x);
202  Pressure & operator -= (const Pressure & x);
207  Pressure & operator *= (const double x);
212  Pressure & operator /= (const double x);
217  Pressure operator + (const Pressure & x) const;
222  Pressure operator - (const Pressure & x) const;
227  Pressure operator * (const double x) const;
232  Pressure operator / (const double x) const;
237  bool operator < (const Pressure & x) const;
242  bool operator > (const Pressure & x) const;
247  bool operator <= (const Pressure & x) const;
252  bool operator >= (const Pressure & x) const;
257  bool operator == (const Pressure & x) const;
262  bool equals(const Pressure & x) const;
267  bool operator != (const Pressure & x) const;
272  bool isZero() const;
276  Pressure operator - () const;
280  Pressure operator + () const;
285  std::string toString() const;
289  std::string toStringI() const;
294  operator std::string () const;
299  double get() const;
300 #ifndef WITHOUT_ACS
301 
305  asdmIDLTypes::IDLPressure toIDLPressure() const;
306 #endif
307 
311  static std::string unit();
312 private:
313  double value;
314 };
315 // Pressure constructors
316 inline Pressure::Pressure() : value(0.0) {
317 }
318 inline Pressure::Pressure(const Pressure &t) : value(t.value) {
319 }
320 #ifndef WITHOUT_ACS
321 inline Pressure::Pressure(const asdmIDLTypes::IDLPressure &l) : value(l.value) {
322 }
323 #endif
324 inline Pressure::Pressure(const std::string &s) : value(fromString(s)) {
325 }
326 inline Pressure::Pressure(double v) : value(v) {
327 }
328 // Pressure destructor
330 // assignment operator
332  value = t.value;
333  return *this;
334 }
335 // assignment operator
336 inline Pressure & Pressure::operator = ( const double v ) {
337  value = v;
338  return *this;
339 }
340 // assignment with arithmetic operators
342  value += t.value;
343  return *this;
344 }
346  value -= t.value;
347  return *this;
348 }
349 inline Pressure & Pressure::operator *= ( const double n) {
350  value *= n;
351  return *this;
352 }
353 inline Pressure & Pressure::operator /= ( const double n) {
354  value /= n;
355  return *this;
356 }
357 // arithmetic functions
358 inline Pressure Pressure::operator + ( const Pressure &t2 ) const {
359  Pressure tmp;
360  tmp.value = value + t2.value;
361  return tmp;
362 }
363 inline Pressure Pressure::operator - ( const Pressure &t2 ) const {
364  Pressure tmp;
365  tmp.value = value - t2.value;
366  return tmp;
367 }
368 inline Pressure Pressure::operator * ( const double n) const {
369  Pressure tmp;
370  tmp.value = value * n;
371  return tmp;
372 }
373 inline Pressure Pressure::operator / ( const double n) const {
374  Pressure tmp;
375  tmp.value = value / n;
376  return tmp;
377 }
378 // comparison operators
379 inline bool Pressure::operator < (const Pressure & x) const {
380  return (value < x.value);
381 }
382 inline bool Pressure::operator > (const Pressure & x) const {
383  return (value > x.value);
384 }
385 inline bool Pressure::operator <= (const Pressure & x) const {
386  return (value <= x.value);
387 }
388 inline bool Pressure::operator >= (const Pressure & x) const {
389  return (value >= x.value);
390 }
391 inline bool Pressure::equals(const Pressure & x) const {
392  return (value == x.value);
393 }
394 inline bool Pressure::operator == (const Pressure & x) const {
395  return (value == x.value);
396 }
397 inline bool Pressure::operator != (const Pressure & x) const {
398  return (value != x.value);
399 }
400 // unary - and + operators
402  Pressure tmp;
403  tmp.value = -value;
404  return tmp;
405 }
407  Pressure tmp;
408  tmp.value = value;
409  return tmp;
410 }
411 // Conversion functions
412 inline Pressure::operator std::string () const {
413  return toString();
414 }
415 inline std::string Pressure::toString() const {
416  return toString(value);
417 }
418 inline std::string Pressure::toStringI() const {
419  return toString(value);
420 }
421 inline double Pressure::get() const {
422  return value;
423 }
424 #ifndef WITHOUT_ACS
425 inline asdmIDLTypes::IDLPressure Pressure::toIDLPressure() const {
426  asdmIDLTypes::IDLPressure tmp;
427  tmp.value = value;
428  return tmp;
429 }
430 #endif
431 // Friend functions
432 inline Pressure operator * ( double n, const Pressure &x) {
433  Pressure tmp;
434  tmp.value = x.value * n;
435  return tmp;
436 }
437 inline std::ostream & operator << ( std::ostream &o, const Pressure &x ) {
438  o << x.value;
439  return o;
440 }
441 inline std::istream & operator >> ( std::istream &i, Pressure &x ) {
442  i >> x.value;
443  return i;
444 }
445 inline std::string Pressure::unit() {
446  return std::string ("hPa");
447 }
448 } // End namespace asdm
449 #endif /* Pressure_CLASS */
static Pressure getPressure(StringTokenizer &st)
Parse the next (string) token of a StringTokenizer into an angle.
bool operator<(const Pressure &x) const
Comparison operator.
Definition: Pressure.h:379
Pressure & operator-=(const Pressure &x)
Operator decrement and assign.
Definition: Pressure.h:345
Pressure & operator=(const Pressure &x)
An assignment operator Pressure = Pressure.
Definition: Pressure.h:331
std::istream & operator>>(std::istream &, EntityId &)
Definition: EntityId.h:164
Pressure & operator+=(const Pressure &x)
Operator increment and assign.
Definition: Pressure.h:341
The StringTokenizer class is a translation into C++ of the Java class of the same name in Java&#39;s util...
bool operator>=(const Pressure &x) const
Comparison operator.
Definition: Pressure.h:388
bool operator==(const Pressure &x) const
Comparision operator.
Definition: Pressure.h:394
static std::vector< std::vector< std::vector< Pressure > > > from3DBin(EndianIStream &eis)
Read the binary representation of a vector of vector of vector of Pressure from an EndianIStream and ...
static Pressure fromBin(EndianIStream &eis)
Read the binary representation of an Pressure from a EndianIStream and use the read value to set an P...
The NumberFormatException class represents an exception when an error occurs in converting a numeric ...
Length operator*(double, const Length &)
Friend functions.
Definition: Length.h:432
static std::vector< Pressure > from1DBin(EndianIStream &eis)
Read the binary representation of a vector of Pressure from an EndianIStream and use the read value t...
bool operator>(const Pressure &x) const
Comparison operator.
Definition: Pressure.h:382
std::ostream & operator<<(std::ostream &, const EntityId &)
Friend functions.
Definition: EntityId.h:159
bool operator!=(const Pressure &x) const
Comparison operator.
Definition: Pressure.h:397
casacore::String toString(VisibilityProcessor::ProcessingType p)
std::string toStringI() const
Idem toString.
Definition: Pressure.h:418
The Pressure class implements a quantity of pressure in hectopascals.
Definition: Pressure.h:53
void toBin(EndianOSStream &eoss)
Write the binary representation of this to an EndianOSStream .
static std::vector< std::vector< Pressure > > from2DBin(EndianIStream &eis)
Read the binary representation of a vector of vector of Pressure from an EndianIStream and use the re...
friend std::istream & operator>>(std::istream &is, Pressure &x)
Overloading of &gt;&gt; to read an Pressure from an istream.
static std::string unit()
Returns the abbreviated name of the unit implicitely associated to any Pressure.
Definition: Pressure.h:445
Pressure operator/(const double x) const
Division operator.
Definition: Pressure.h:373
double get() const
Return the double precision value of the Pressure.
Definition: Pressure.h:421
Defines pressure with units.
Definition: ATMPressure.h:43
Pressure()
The nullary constructor (default).
Definition: Pressure.h:316
asdmIDLTypes::IDLPressure toIDLPressure() const
Return the IDLPressure representation of the Pressure.
Definition: Pressure.h:425
static double fromString(const std::string &s)
A static method equivalent to the constructor from a string.
friend Pressure operator*(double d, const Pressure &x)
Overloading of multiplication operator.
std::string toString() const
Converts into a string.
Definition: Pressure.h:415
Pressure & operator/=(const double x)
Operator divide and assign.
Definition: Pressure.h:353
Pressure operator+() const
Unary operator.
Definition: Pressure.h:406
double value
Definition: Pressure.h:313
bool equals(const Pressure &x) const
Comparison method.
Definition: Pressure.h:391
Pressure operator-() const
Unary operator.
Definition: Pressure.h:401
Pressure & operator*=(const double x)
Operator multiply and assign.
Definition: Pressure.h:349
virtual ~Pressure()
The destructor.
Definition: Pressure.h:329
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
bool operator<=(const Pressure &x) const
Comparison operator.
Definition: Pressure.h:385
friend std::ostream & operator<<(std::ostream &os, const Pressure &x)
Overloading of &lt;&lt; to output the value an Pressure on an ostream.
bool isZero() const
Comparison method.