CARMA C++
Frequency.h
1 #ifndef SZA_UTIL_FREQUENCY_H
2 #define SZA_UTIL_FREQUENCY_H
3 
11 #include <iostream>
12 
13 #include "carma/szautil/ConformableQuantity.h"
14 #include "carma/szautil/Speed.h"
15 
16 namespace sza {
17  namespace util {
18 
19  class Rx;
20  class Wavelength;
21 
22  class Frequency : public ConformableQuantity {
23  public:
24 
25  // A few useful conversions
26 
27  static const double HzPerGHz_;
28  static const double HzPerMHz_;
29  static Speed lightSpeed_;
30 
31  class MegaHz {};
32  class GigaHz {};
33 
37  Frequency();
38  Frequency(const MegaHz& units, double MHz);
39  Frequency(const GigaHz& units, double GHz);
40  Frequency(Wavelength& wavelength);
41 
45  virtual ~Frequency();
46 
47  virtual void setVal(double val, std::string units);
48 
49  // Set the frequency, in GHz
50 
51  void setGHz(double GHz);
52 
53  // Set the frequency, in MHz
54 
55  void setMHz(double MHz);
56 
57  // Set the frequency, in MHz
58 
59  void setHz(double Hz);
60 
61  // Return the frequency, in GHz
62 
63  inline double GHz() {
64  return Hz_ / HzPerGHz_;
65  }
66 
67  // Return the frequency, in MHz
68 
69  inline double MHz() {
70  return Hz_ / HzPerMHz_;
71  }
72 
73  double microns();
74  double centimeters();
75  double meters();
76 
77  Wavelength wavelength();
78 
79  inline unsigned short yigUnits() {
80  return (unsigned short)MHz();
81  }
82 
83  inline unsigned short gunnUnits() {
84  return (unsigned short)(GHz() * 100);
85  }
86 
87  // Return the frequency, in Hz
88 
89  inline double Hz() const {
90  return Hz_;
91  }
92 
96  friend std::ostream& operator<<(std::ostream& os, Frequency& frequency);
97 
98  Frequency operator-(Frequency& frequency);
99  Frequency operator+(Frequency& frequency);
100  bool operator<(Frequency& frequency);
101  bool operator>(Frequency& frequency);
102 
103  void initialize();
104 
105  private:
106 
107  friend class Rx;
108  friend class CorrelatorBand;
109 
110  // Constructor -- only Rx can call this constructor
111 
112  Frequency(double Hz);
113 
114  // The actual frequency, in Hz
115 
116  double Hz_;
117 
118  }; // End class Frequency
119 
120  } // End namespace util
121 } // End namespace sza
122 
123 
124 
125 #endif // End #ifndef SZA_UTIL_FREQUENCY_H
Tagged: Wed Dec 1 23:39:12 PST 2004.