casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ATMMassDensity.h
Go to the documentation of this file.
1 #ifndef _ATM_MASSDENSITY_H
2 #define _ATM_MASSDENSITY_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: ATMMassDensity.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 
45 {
46 public:
48  MassDensity();
50  MassDensity(double massdensity);
54  MassDensity(double massdensity, const string &units);
55 
57  virtual ~MassDensity();
58 
60  double get() const { return valueIS_; }
63  double get(const string &units) const;
64 
65  MassDensity& operator=(const MassDensity &rhs) { if(&rhs != this) valueIS_ = rhs.valueIS_; return *this; }
66  MassDensity& operator=(double rhs) { valueIS_ = rhs; return *this; }
67  MassDensity operator+(const MassDensity &rhs) { return MassDensity(valueIS_ + rhs.get()); }
68  MassDensity operator-(const MassDensity &rhs) { return MassDensity(valueIS_ - rhs.get()); }
69  MassDensity operator*(double scf) { return MassDensity(valueIS_ * scf); }
70  MassDensity operator*(float scf) { return MassDensity(valueIS_ * (double) scf); }
71  MassDensity operator*(int scf) { return MassDensity(valueIS_ * (double) scf); }
72  MassDensity operator*(unsigned int scf) { return MassDensity(valueIS_ * (double) scf); }
73  MassDensity operator/(double scf) { return MassDensity(valueIS_ / scf); }
74  MassDensity operator/(float scf) { return MassDensity(valueIS_ / (double) scf); }
75  MassDensity operator/(int scf) { return MassDensity(valueIS_ / (double) scf); }
76  MassDensity operator/(unsigned int scf) { return MassDensity(valueIS_ / (double) scf); }
77  bool operator<(const MassDensity & rhs) const { return (valueIS_ < rhs.get()); }
78  bool operator>(const MassDensity & rhs) const { return (valueIS_ > rhs.get()); }
79  bool operator<=(const MassDensity & rhs) const { return (valueIS_ <= rhs.get()); }
80  bool operator>=(const MassDensity & rhs) const { return (valueIS_ >= rhs.get()); }
81  bool operator==(const MassDensity & rhs) const { return (valueIS_ == rhs.get()); }
82  bool operator!=(const MassDensity & rhs) const { return (valueIS_ != rhs.get()); }
83 
84  private:
85  double valueIS_;
86 }; // class MassDensity
87 
89 
90 #endif
#define ATM_NAMESPACE_END
Definition: ATMCommon.h:38
bool operator<=(const MassDensity &rhs) const
bool operator<(const MassDensity &rhs) const
MassDensity()
Default constructor.
MassDensity operator*(unsigned int scf)
MassDensity operator*(int scf)
bool operator>(const MassDensity &rhs) const
MassDensity operator/(float scf)
MassDensity operator*(float scf)
MassDensity operator/(double scf)
virtual ~MassDensity()
Destructor.
double valueIS_
MassDensity operator/(unsigned int scf)
double get() const
Accessor to the massdensity value in International System units (kgm**-3)
bool operator==(const MassDensity &rhs) const
#define ATM_NAMESPACE_BEGIN
Definition: ATMCommon.h:37
MassDensity operator/(int scf)
MassDensity & operator=(const MassDensity &rhs)
MassDensity & operator=(double rhs)
MassDensity operator-(const MassDensity &rhs)
bool operator>=(const MassDensity &rhs) const
MassDensity operator+(const MassDensity &rhs)
bool operator!=(const MassDensity &rhs) const
Mass Density value with units.
MassDensity operator*(double scf)