CARMA C++
HourAngle.h
Go to the documentation of this file.
1 // $Id: HourAngle.h,v 1.16 2006/01/13 14:36:04 cgwon Exp $
2 
14 #ifndef CARMA_SERVICES_HOURANGLE_H
15 #define CARMA_SERVICES_HOURANGLE_H
16 
17 #include "carma/services/Angle.h"
18 #include <iostream>
19 #include <string>
20 
21 namespace carma {
22  namespace services {
36  class HourAngle : public Angle {
37  public:
38 
44  HourAngle(double value,
45  const std::string& units);
46 
48  virtual ~HourAngle();
49 
50  double convert(const std::string& convertTo) const;
51 
52  std::string getUnits() const;
53 
60  double hours() const;
61 
71  void reset(double value, const std::string& units);
72 
80  const HourAngle operator+(const HourAngle& angle) const;
81 
89  const HourAngle operator-(const HourAngle& angle) const;
90 
95  HourAngle &operator+=(const HourAngle &frequency);
96 
101  HourAngle &operator-=(const HourAngle &frequency);
102 
107  std::string getString(int precision=0);
108 
113  std::string getLstString(int precision=0);
114 
120  static inline std::string getAngleString(double angle, int precision=0) {
121  return Angle::getAngleString(angle, precision, false);
122  }
123 
124  static std::string hms(double decimalHours, int precision);
125 
126  private:
127 
132  HourAngle moduloPi(double value) const;
133  double moduloPiDouble(double value) const;
142  inline static std::string hourUnits()
143  {
144  return "circle (hours/day)";
145  }
146 
152  bool isHours(const std::string& units) const;
153 
154  std::string HOURS_;
155 
156  };
157 
161 std::ostream& operator<<(std::ostream& os,
162  const carma::services::HourAngle& hourangle);
163 
164  }
165 }
166 
167 
168 
169 #endif //CARMA_SERVICES_HOURANGLE_H
double hours() const
Convenience method that returns the value of this angle in hours.
std::string getLstString(int precision=0)
Return LST for HourAngle value in +/-hh:mm:ss.s format.
double convert(const std::string &convertTo) const
Converts this quantity to any conformable units.
Representation of an angle, return values are always modulo 2PI radians.
HourAngle(double value, const std::string &units)
Construct an HourAngle given a value and units.
std::string getString(int precision=0)
Return the HourAngle value as a string in +/-hh:mm:ss.s format.
The Angle class can represent any angle in any units.
Definition: Angle.h:38
HourAngle & operator+=(const HourAngle &frequency)
Increment HourAngle.
HourAngle & operator-=(const HourAngle &frequency)
Decrement HourAngle.
const HourAngle operator+(const HourAngle &angle) const
Add two HourAngles.
static std::string getAngleString(double angle, int precision=0)
return angle in a +/-hh:mm:ss.s format
Definition: HourAngle.h:120
void reset(double value, const std::string &units)
Reset method to change value and/or units.
std::ostream & operator<<(std::ostream &os, const carma::services::Angle &angle)
Define the &lt;&lt; operator to allow, e.g.
std::string getUnits() const
virtual ~HourAngle()
Destructor.
const HourAngle operator-(const HourAngle &angle) const
Subtract two HourAngles.
The HourAngle class extends carma::services::Angle to specifically support hour angles.
Definition: HourAngle.h:36