casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ATMTemperature.h
Go to the documentation of this file.
1 #ifndef _ATM_TEMPERATURE_H
2 #define _ATM_TEMPERATURE_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: ATMTemperature.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 
38 
39 
47 {
48 public:
50  Temperature();
52  Temperature(double temperature);
55  Temperature(double temperature, const string &units);
56 
58  virtual ~Temperature() {};
59 
61 
62  double get() const { return valueIS_; }
64  double get(const string &units) const;
66 
67  Temperature& operator=(const Temperature &rhs){ if(&rhs != this) valueIS_ = rhs.valueIS_; return *this; }
68  Temperature& operator=(double rhs) { valueIS_ = rhs; return *this; }
69  Temperature operator+(const Temperature &rhs) { return Temperature(valueIS_ + rhs.get()); }
70  Temperature operator-(const Temperature &rhs) { return Temperature(valueIS_ - rhs.get()); }
71  Temperature operator*(double scf) { return Temperature(valueIS_ * scf); }
72  Temperature operator*(float scf) { return Temperature(valueIS_ * (double) scf); }
73  Temperature operator*(int scf) { return Temperature(valueIS_ * (double) scf); }
74  Temperature operator*(unsigned int scf) { return Temperature(valueIS_ * (double) scf); }
75  Temperature operator/(double scf) { return Temperature(valueIS_ / scf); }
76  Temperature operator/(float scf) { return Temperature(valueIS_ / (double) scf); }
77  Temperature operator/(int scf) { return Temperature(valueIS_ / (double) scf); }
78  Temperature operator/(unsigned int scf) { return Temperature(valueIS_ / (double) scf); }
79  bool operator<(const Temperature &rhs) const { return (valueIS_ < rhs.get()); }
80  bool operator>(const Temperature &rhs) const { return (valueIS_ > rhs.get()); }
81  bool operator<=(const Temperature &rhs) const { return (valueIS_ <= rhs.get()); }
82  bool operator>=(const Temperature &rhs) const { return (valueIS_ >= rhs.get()); }
83  bool operator==(const Temperature &rhs) const { return (valueIS_ == rhs.get()); }
84  bool operator!=(const Temperature &rhs) const { return (valueIS_ != rhs.get()); }
85 
86 private:
87  double valueIS_;
88 }; // class Temperature
89 
91 
92 #endif
#define ATM_NAMESPACE_END
Definition: ATMCommon.h:38
virtual ~Temperature()
Destructor.
Temperature operator*(double scf)
Temperature operator*(int scf)
bool operator<=(const Temperature &rhs) const
Temperature()
Default constructor.
double get() const
Accessor to the temperature value in International System units (K)
Temperature operator*(unsigned int scf)
Temperature operator+(const Temperature &rhs)
Temperature & operator=(const Temperature &rhs)
bool operator>(const Temperature &rhs) const
Temperature operator*(float scf)
double valueIS_
Temperature operator/(double scf)
#define ATM_NAMESPACE_BEGIN
Definition: ATMCommon.h:37
bool operator==(const Temperature &rhs) const
Temperature operator/(unsigned int scf)
Temperature operator-(const Temperature &rhs)
bool operator<(const Temperature &rhs) const
bool operator!=(const Temperature &rhs) const
bool operator>=(const Temperature &rhs) const
Temperature operator/(float scf)
Temperature value with units.
Temperature operator/(int scf)
Temperature & operator=(double rhs)