CARMA C++
Voltage.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_VOLTAGE_H
2 #define SZA_UTIL_VOLTAGE_H
3 
11 #include <iostream>
12 
13 #include "carma/szautil/ConformableQuantity.h"
14 
15 namespace sza {
16  namespace util {
17 
18  class Voltage : public ConformableQuantity {
19  public:
20 
21  enum Id {
22  DRAIN,
23  GATE
24  };
25 
26  static const double centiVoltsPerVolt_;
27  static const double milliVoltsPerVolt_;
28 
29  class Volts {};
30  class CentiVolts {};
31  class MilliVolts {};
32 
33  // Constructors
34 
35  Voltage();
36  Voltage(const Volts& units, double volts);
37  Voltage(const CentiVolts& units, double centiVolts);
38  Voltage(const MilliVolts& units, double milliVolts);
39 
40  // Destructor
41 
42  virtual ~Voltage();
43 
44  // Set methods
45 
46  void setVolts(double volts);
47  void setCentiVolts(double centiVolts);
48  void setMilliVolts(double milliVolts);
49 
50  // Return the frequency, in GHz
51 
52  inline double volts() {
53  return volts_;
54  }
55 
56  inline double centiVolts() {
57  return volts_ * centiVoltsPerVolt_;;
58  }
59 
60  inline double milliVolts() {
61  return volts_ * milliVoltsPerVolt_;;
62  }
63 
64  inline unsigned short gunnUnits() {
65  return (unsigned short)centiVolts();
66  }
67 
68  friend std::ostream& operator<<(std::ostream& os, Voltage& voltage);
69 
70  private:
71 
72  double volts_;
73 
74  void initialize();
75 
76  }; // End class Voltage
77 
78  std::ostream& operator<<(std::ostream& os, Voltage& voltage);
79 
80  } // End namespace util
81 } // End namespace sza
82 
83 
84 
85 #endif // End #ifndef SZA_UTIL_VOLTAGE_H