casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ATMPressure.h
Go to the documentation of this file.
1 #ifndef _ATM_PRESSURE_H
2 #define _ATM_PRESSURE_H
3 /*******************************************************************************
4  * ALMA - Atacama Large Millimiter Array
5  * (c) Instituto de Estructura de la Materia, 2009
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  *
21  * "@(#) $Id: ATMPressure.h Exp $"
22  *
23  * who when what
24  * -------- -------- ----------------------------------------------
25  * pardo 24/03/09 created
26  */
27 
28 #ifndef __cplusplus
29 #error "This is a C++ include file and cannot be used from plain C"
30 #endif
31 
32 #include "ATMCommon.h"
33 #include <string>
34 
35 using std::string;
36 
43 class Pressure
44 {
45 public:
46 
48  Pressure();
50  Pressure(double pressure);
52  Pressure(double pressure, const string &units);
53 
55  virtual ~Pressure();
56 
58  double get() const { return valueIS_; }
61  double get(const string &units) const;
62 
63  Pressure& operator=(const Pressure &rhs) { if(&rhs != this) valueIS_ = rhs.valueIS_; return *this; }
64  Pressure& operator=(double rhs) { valueIS_ = rhs; return *this; }
65  Pressure operator+(const Pressure &rhs) { return Pressure(valueIS_ + rhs.get()); }
66  Pressure operator-(const Pressure &rhs) { return Pressure(valueIS_ - rhs.get()); }
67  Pressure operator*(double scf) { return Pressure(valueIS_ * scf); }
68  Pressure operator*(float scf) { return Pressure(valueIS_ * (double) scf); }
69  Pressure operator*(int scf) { return Pressure(valueIS_ * (double) scf); }
70  Pressure operator*(unsigned int scf) { return Pressure(valueIS_ * (double) scf); }
71  Pressure operator/(double scf) { return Pressure(valueIS_ / scf); }
72  Pressure operator/(float scf) { return Pressure(valueIS_ / (double) scf); }
73  Pressure operator/(int scf) { return Pressure(valueIS_ / (double) scf); }
74  Pressure operator/(unsigned int scf) { return Pressure(valueIS_ / (double) scf); }
75  bool operator<(const Pressure &rhs) const { return (valueIS_ < rhs.get()); }
76  bool operator>(const Pressure &rhs) const { return (valueIS_ > rhs.get()); }
77  bool operator<=(const Pressure &rhs) const { return (valueIS_ <= rhs.get()); }
78  bool operator>=(const Pressure &rhs) const { return (valueIS_ >= rhs.get()); }
79  bool operator==(const Pressure &rhs) const { return (valueIS_ == rhs.get()); }
80  bool operator!=(const Pressure &rhs) const { return (valueIS_ != rhs.get()); }
81 
82 private:
83  double valueIS_;
84 }; // class Pressure
85 
87 
88 #endif
#define ATM_NAMESPACE_END
Definition: ATMCommon.h:38
bool operator>(const Pressure &rhs) const
Definition: ATMPressure.h:76
Pressure operator*(unsigned int scf)
Definition: ATMPressure.h:70
Pressure operator*(float scf)
Definition: ATMPressure.h:68
double get() const
Accessor to get the value in SI units (Pa)
Definition: ATMPressure.h:58
bool operator<=(const Pressure &rhs) const
Definition: ATMPressure.h:77
virtual ~Pressure()
Destructor.
Pressure & operator=(double rhs)
Definition: ATMPressure.h:64
Pressure operator/(double scf)
Definition: ATMPressure.h:71
Pressure operator-(const Pressure &rhs)
Definition: ATMPressure.h:66
bool operator>=(const Pressure &rhs) const
Definition: ATMPressure.h:78
Pressure operator/(float scf)
Definition: ATMPressure.h:72
Pressure operator*(int scf)
Definition: ATMPressure.h:69
#define ATM_NAMESPACE_BEGIN
Definition: ATMCommon.h:37
Pressure operator+(const Pressure &rhs)
Definition: ATMPressure.h:65
Pressure operator/(unsigned int scf)
Definition: ATMPressure.h:74
bool operator<(const Pressure &rhs) const
Definition: ATMPressure.h:75
Defines pressure with units.
Definition: ATMPressure.h:43
bool operator==(const Pressure &rhs) const
Definition: ATMPressure.h:79
bool operator!=(const Pressure &rhs) const
Definition: ATMPressure.h:80
Pressure & operator=(const Pressure &rhs)
Definition: ATMPressure.h:63
Pressure()
Default constructor.
double valueIS_
Definition: ATMPressure.h:83
Pressure operator/(int scf)
Definition: ATMPressure.h:73
Pressure operator*(double scf)
Definition: ATMPressure.h:67