casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ATMInverseLength.h
Go to the documentation of this file.
1 #ifndef _ATM_INVERSELENGTH_H
2 #define _ATM_INVERSELENGTH_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: ATMInverseLength.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 
36 
44 {
45 public:
47  InverseLength();
49  InverseLength(double inverseLength);
51  InverseLength(double inverseLength, const std::string &units);
53  InverseLength (const InverseLength &inverseLength);
54 
56  virtual ~InverseLength();
57 
59  inline double get() const { return valueIS_; }
62  inline double get(const std::string &units) const { return sget(valueIS_, units); }
63 
65  inline InverseLength& operator=(const InverseLength &rhs) { if(&rhs != this) valueIS_ = rhs.valueIS_; return *this; }
67  inline InverseLength& operator=(double rhs) { valueIS_ = rhs; return *this; }
69  inline InverseLength operator+(const InverseLength &rhs) { return InverseLength(valueIS_ + rhs.get()); }
71  inline InverseLength operator-(const InverseLength &rhs) { return InverseLength(valueIS_ - rhs.get()); }
73  inline InverseLength operator*(double scf) { return InverseLength(valueIS_ * scf); }
75  inline InverseLength operator*(float scf) { return InverseLength(valueIS_ * (double) scf); }
77  inline InverseLength operator*(int scf) { return InverseLength(valueIS_ * (double) scf); }
79  inline InverseLength operator*(unsigned int scf) { return InverseLength(valueIS_ * (double) scf); }
81  inline InverseLength operator/(double scf) { return InverseLength(valueIS_ / scf); }
83  inline InverseLength operator/(float scf) { return InverseLength(valueIS_ / (double) scf); }
85  inline InverseLength operator/(int scf) { return InverseLength(valueIS_ / (double) scf); }
87  inline InverseLength operator/(unsigned int scf) { return InverseLength(valueIS_ / (double) scf); }
89  inline bool operator<(const InverseLength & rhs) const { return (valueIS_ < rhs.get()); }
91  inline bool operator>(const InverseLength & rhs) const { return (valueIS_ > rhs.get()); }
93  inline bool operator<=(const InverseLength & rhs) const { return (valueIS_ <= rhs.get()); }
95  inline bool operator>=(const InverseLength & rhs) const { return (valueIS_ >= rhs.get()); }
97  inline bool operator==(const InverseLength & rhs) const { return (valueIS_ == rhs.get()); }
99  inline bool operator!=(const InverseLength & rhs) const { return (valueIS_ != rhs.get()); }
100 
101 private:
102  static double sget(double value, const std::string &units);
103  static double sput(double value, const std::string &units);
104 
105 private:
106  double valueIS_;
107 }; // class InverseLength
108 
110 
111 #endif
#define ATM_NAMESPACE_END
Definition: ATMCommon.h:38
InverseLength operator*(unsigned int scf)
Operator &quot;multiplication of a inverse length by an unsigned int&quot;.
bool operator!=(const InverseLength &rhs) const
Operator &quot;comparator != for two inverse lengths&quot;.
bool operator>(const InverseLength &rhs) const
Operator &quot;comparator &gt; for two inverse lengths&quot;.
bool operator>=(const InverseLength &rhs) const
Operator &quot;comparator &gt;= for two inverse lengths&quot;.
InverseLength()
Default constructor: Length value set to 0 m^-1.
InverseLength & operator=(double rhs)
Operator &quot;equal to a double converted to InverseLength in m-1&quot;.
InverseLength operator/(float scf)
Operator &quot;division of a inverse length by a float&quot;.
InverseLength operator*(float scf)
Operator &quot;multiplication of a inverse length by a float&quot;.
InverseLength operator-(const InverseLength &rhs)
Operator &quot;substraction of inverse lengths&quot;.
bool operator<=(const InverseLength &rhs) const
Operator &quot;comparator &lt;= for two inverse lengths&quot;.
bool operator<(const InverseLength &rhs) const
Operator &quot;comparator &lt; for two inverse lengths&quot;.
bool operator==(const InverseLength &rhs) const
Operator &quot;comparator == for two inverse lengths&quot;.
InverseLength operator+(const InverseLength &rhs)
Operator &quot;addition of inverse lengths&quot;.
Class for those physical parameters having dimensions of Inverse Length [L^-1].
InverseLength operator*(double scf)
Operator &quot;multiplication of a inverse length by a double&quot;.
#define ATM_NAMESPACE_BEGIN
Definition: ATMCommon.h:37
InverseLength & operator=(const InverseLength &rhs)
Operator &quot;equal to a InverseLength&quot;.
double get() const
Accessor to get the numerical value of inverse length (in International System units: m^-1) ...
virtual ~InverseLength()
Destructor.
static double sget(double value, const std::string &units)
InverseLength operator/(double scf)
Operator &quot;division of a inverse length by a double&quot;.
static double sput(double value, const std::string &units)
InverseLength operator*(int scf)
Operator &quot;multiplication of a inverse length by an int&quot;.
InverseLength operator/(int scf)
Operator &quot;division of a inverse length by an int&quot;.
InverseLength operator/(unsigned int scf)
Operator &quot;division of a inverse length by an unsigned int&quot;.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.