My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
HourAngle.h
Go to the documentation of this file.
1 #ifndef GCP_UTIL_HOURANGLE_H
2 #define GCP_UTIL_HOURANGLE_H
3 
11 #include "gcp/util/common/Angle.h"
12 #include "gcp/util/common/Debug.h"
13 
14 namespace gcp {
15  namespace util {
16 
17  class HourAngle : public Angle {
18  public:
19 
23  HourAngle() : Angle(true) {};
24 
28  void setHours(double hours);
29  void setHours(std::string hours);
30  void setHours(double hour, double min, double sec);
31 
35  virtual ~HourAngle();
36 
40  inline double hours() {
41  return radians_ * hourPerRad_;
42  }
43 
47  inline double seconds() {
48  return radians_ * secPerRad_;
49  }
50 
51  inline unsigned getIntegerHours() {
52  unsigned hours = (unsigned)(radians_ * hourPerRad_);
53  return hours;
54  }
55 
56  inline unsigned getIntegerMinutes() {
57  unsigned hours = (unsigned)(radians_ * hourPerRad_);
58  unsigned mins = (unsigned)((radians_ * hourPerRad_ - hours)*60);
59  return mins;
60  }
61 
62 
63  inline unsigned getIntegerSeconds() {
64  unsigned hours = (unsigned)(radians_ * hourPerRad_);
65  unsigned mins = (unsigned)((radians_ * hourPerRad_ - hours)*60);
66  unsigned secs = (unsigned)(((radians_ * hourPerRad_ - hours)*60 - mins)*60);
67  return secs;
68  }
69 
70  inline unsigned getIntegerMilliSeconds() {
71  unsigned hours = (unsigned)(radians_ * hourPerRad_);
72  unsigned mins = (unsigned)((radians_ * hourPerRad_ - hours)*60);
73  unsigned secs = (unsigned)(((radians_ * hourPerRad_ - hours)*60 - mins)*60);
74  return (unsigned)((((radians_ * hourPerRad_ - hours)*60 - mins)*60 - secs) * 1000);
75  }
76 
80  friend std::ostream& operator<<(std::ostream& os, HourAngle& hour);
81 
86 
91 
92  static const double hourPerRad_;
93  static const double secPerRad_;
94 
95  }; // End class HourAngle
96 
97  } // End namespace util
98 } // End namespace gcp
99 
100 #endif // End #ifndef GCP_UTIL_HOURANGLE_H
HourAngle operator+(HourAngle &angle)
Definition: HourAngle.cc:29
virtual ~HourAngle()
Definition: HourAngle.cc:14
double seconds()
Definition: HourAngle.h:47
friend std::ostream & operator<<(std::ostream &os, HourAngle &hour)
Definition: HourAngle.h:17
HourAngle operator-(HourAngle &angle)
Definition: HourAngle.cc:40
Definition: Angle.h:20
HourAngle()
Definition: HourAngle.h:23
void setHours(double hours)
Definition: HourAngle.cc:48
double hours()
Definition: HourAngle.h:40