casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ATMAngle.h
Go to the documentation of this file.
1 #ifndef _ATM_ANGLE_H
2 #define _ATM_ANGLE_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: ATMAngle.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 
44 class Angle
45 {
46  public:
48  Angle();
50  Angle(double angle);
52  Angle(double angle, const string &units);
53 
55  virtual ~Angle();
56 
58  double get() const { return valueIS_; }
61  double get(const string &units) const;
62 
64  Angle& operator=(const Angle &rhs) { if(&rhs != this) valueIS_ = rhs.valueIS_; return *this; }
66  Angle& operator=(double rhs) { valueIS_=rhs; return *this; }
68  Angle operator+(const Angle &rhs) { return Angle(valueIS_+rhs.get()); }
70  Angle operator-(const Angle &rhs) { return Angle(valueIS_-rhs.get()); }
72  Angle operator*(double scf) { return Angle(valueIS_*scf); }
74  Angle operator*(float scf) { return Angle(valueIS_*(double)scf); }
76  Angle operator*(int scf) { return Angle(valueIS_*(double)scf); } // rhs scale factor
78  Angle operator*(unsigned int scf) { return Angle(valueIS_*(double)scf); } // rhs scale factor
80  Angle operator/(double scf) { return Angle(valueIS_/scf); }
82  Angle operator/(float scf) { return Angle(valueIS_/(double)scf); }
84  Angle operator/(int scf) { return Angle(valueIS_/(double)scf); }
86  Angle operator/(unsigned int scf) { return Angle(valueIS_/(double)scf); }
88  bool operator<(const Angle & rhs) const { return (valueIS_<rhs.get()); }
90  bool operator>(const Angle & rhs) const { return (valueIS_>rhs.get()); }
92  bool operator<=(const Angle & rhs) const { return (valueIS_<=rhs.get()); }
94  bool operator>=(const Angle & rhs) const { return (valueIS_>=rhs.get()); }
96  bool operator==(const Angle & rhs) const { return (valueIS_==rhs.get()); }
98  bool operator!=(const Angle & rhs) const { return (valueIS_!=rhs.get()); }
99 
100  private:
101  double valueIS_;
102 }; // class Angle
103 
105 
106 #endif
Angle()
Default constructor.
#define ATM_NAMESPACE_END
Definition: ATMCommon.h:38
virtual ~Angle()
Destructor.
Angle operator+(const Angle &rhs)
Operator &quot;addition of angles&quot;.
Definition: ATMAngle.h:68
bool operator==(const Angle &rhs) const
Operator &quot;comparator == for two angles&quot;.
Definition: ATMAngle.h:96
Angle operator/(float scf)
Operator &quot;division of a angle by a float&quot;.
Definition: ATMAngle.h:82
Angle operator/(unsigned int scf)
Operator &quot;division of a angle by an unsigned int&quot;.
Definition: ATMAngle.h:86
Angle operator*(double scf)
Operator &quot;multiplication of a angle by a double&quot;.
Definition: ATMAngle.h:72
Angle operator*(float scf)
Operator &quot;multiplication of a angle by a float&quot;.
Definition: ATMAngle.h:74
Angle operator-(const Angle &rhs)
Operator &quot;substraction of angles&quot;.
Definition: ATMAngle.h:70
bool operator!=(const Angle &rhs) const
Operator &quot;comparator != for two angles&quot;.
Definition: ATMAngle.h:98
Angle operator/(int scf)
Operator &quot;division of a angle by an int&quot;.
Definition: ATMAngle.h:84
Angle & operator=(const Angle &rhs)
Operator &quot;equal to a Angle&quot;.
Definition: ATMAngle.h:64
Angle operator*(int scf)
Operator &quot;multiplication of a angle by an int&quot;.
Definition: ATMAngle.h:76
#define ATM_NAMESPACE_BEGIN
Definition: ATMCommon.h:37
double get() const
Accessor to get the angle value in SI units (rad)
Definition: ATMAngle.h:58
Angle & operator=(double rhs)
Operator &quot;equal to a double converted to Angle in Hz&quot;.
Definition: ATMAngle.h:66
bool operator>(const Angle &rhs) const
Operator &quot;comparator &gt; for two angles&quot;.
Definition: ATMAngle.h:90
Angle operator*(unsigned int scf)
Operator &quot;multiplication of a angle by an unsigned int&quot;.
Definition: ATMAngle.h:78
bool operator<=(const Angle &rhs) const
Operator &quot;comparator &lt;= for two angles&quot;.
Definition: ATMAngle.h:92
Defines a Class for those parameters being angles.
Definition: ATMAngle.h:44
bool operator>=(const Angle &rhs) const
Operator &quot;comparator &gt;= for two angles&quot;.
Definition: ATMAngle.h:94
bool operator<(const Angle &rhs) const
Operator &quot;comparator &lt; for two angles&quot;.
Definition: ATMAngle.h:88
double valueIS_
Definition: ATMAngle.h:101
Angle operator/(double scf)
Operator &quot;division of a angle by a double&quot;.
Definition: ATMAngle.h:80