CARMA C++
OffsetMsg.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_OFFSETMSG_H
2 #define SZA_UTIL_OFFSETMSG_H
3 
11 #include <ostream>
12 
13 namespace sza {
14  namespace util {
15 
16  class OffsetMsg {
17  public:
18 
22  enum Type {
23  MOUNT,
24  EQUAT,
25  TV,
26  SKY
27  };
28 
32  enum Mode {
33  ADD, // Add the offsets to the current values
34  SET // Replace the current values with the passed offsets
35  };
36 
41  enum Axis {
42  NONE = 0x0,
43  AZ = 0x1,
44  EL = 0x2,
45  BOTH = AZ|EL,
46  PA = 0x4,
47  RA = 0x8,
48  DEC = 0x16,
49  X = 0x32,
50  Y = 0x64,
51  UP = 0x128,
52  RIGHT = 0x256,
53  };
54 
59  union {
60  struct {
61  double az;
62  double el;
63  double pa;
64  } mount;
65 
66  struct {
67  double ra;
68  double dec;
69  } equat;
70 
71  struct {
72  double up;
73  double right;
74  } tv;
75 
76  struct {
77  double x;
78  double y;
79  } sky;
80 
81  } body;
82 
83  Type type;
84  Mode mode;
85  Axis axes;
86 
87  inline void packMountOffsets(Mode offMode, Axis offAxes,
88  double az, double el, double pa)
89  {
90  type = MOUNT;
91  mode = offMode;
92  axes = offAxes;
93 
94  body.mount.az = az;
95  body.mount.el = el;
96  body.mount.pa = pa;
97  }
98 
99  inline void packEquatOffsets(Mode offMode, Axis offAxes,
100  double ra, double dec)
101  {
102  type = EQUAT;
103  mode = offMode;
104  axes = offAxes;
105 
106  body.equat.ra = ra;
107  body.equat.dec = dec;
108  }
109 
110  inline void packTvOffsets(double up, double right)
111  {
112  type = TV;
113  mode = ADD;
114  axes = (Axis)(UP|RIGHT);
115 
116  body.tv.up = up;
117  body.tv.right = right;
118  }
119 
120  inline void packSkyOffsets(Mode offMode, Axis offAxes,
121  double x, double y)
122  {
123  type = SKY;
124  mode = offMode;
125  axes = offAxes;
126 
127  body.sky.x = x;
128  body.sky.y = y;
129  }
130 
134  friend std::ostream& operator<<(std::ostream& os, OffsetMsg* msg);
135 
136  }; // End class OffsetMsg
137 
138  } // End namespace util
139 } // End namespace sza
140 
141 
142 #endif // End #ifndef SZA_UTIL_OFFSETMSG_H
Add a turn.
Definition: AzWrapMode.idl:13