My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
OffsetMsg.h
Go to the documentation of this file.
1 #ifndef GCP_UTIL_OFFSETMSG_H
2 #define GCP_UTIL_OFFSETMSG_H
3 
11 namespace gcp {
12  namespace util {
13 
14  class OffsetMsg {
15  public:
16 
20  enum Type {
21  MOUNT,
22  EQUAT,
23  TV,
24  SKY
25  };
26 
30  enum Mode {
31  ADD, // Add the offsets to the current values
32  SET, // Replace the current values with the passed offsets
33  FIXED,
34  POLAR
35  };
36 
41  enum Axis {
42  NONE = 0x0,
43  AZ = 0x1,
44  EL = 0x2,
45  PA = 0x4,
46  RA = 0x8,
47  DEC = 0x16,
48  X = 0x32,
49  Y = 0x64,
50  UP = 0x128,
51  RIGHT = 0x256,
52  };
53 
58  union {
59  struct {
60  double az;
61  double el;
62  double pa;
63  } mount;
64 
65  struct {
66  double ra;
67  double dec;
68  } equat;
69 
70  struct {
71  double up;
72  double right;
73  } tv;
74 
75  struct {
76  double x;
77  double y;
78  } sky;
79 
80  } body;
81 
82  Type type;
83  Mode mode;
84  Axis axes;
85 
86  inline void packMountOffsets(Mode offMode, Axis offAxes,
87  double az, double el, double pa)
88  {
89  type = MOUNT;
90  mode = offMode;
91  axes = offAxes;
92 
93  body.mount.az = az;
94  body.mount.el = el;
95  body.mount.pa = pa;
96  }
97 
98  inline void packEquatOffsets(Mode offMode, Axis offAxes,
99  double ra, double dec)
100  {
101  type = EQUAT;
102  mode = offMode;
103  axes = offAxes;
104 
105  body.equat.ra = ra;
106  body.equat.dec = dec;
107  }
108 
109  inline void packTvOffsets(double up, double right)
110  {
111  type = TV;
112  mode = ADD;
113  axes = (Axis)(UP|RIGHT);
114 
115  body.tv.up = up;
116  body.tv.right = right;
117  }
118 
119  inline void packSkyOffsets(Mode offMode, Axis offAxes,
120  double x, double y)
121  {
122  type = SKY;
123  mode = offMode;
124  axes = offAxes;
125 
126  body.sky.x = x;
127  body.sky.y = y;
128  }
129 
130  }; // End class OffsetMsg
131 
132  } // End namespace util
133 } // End namespace gcp
134 
135 
136 
137 #endif // End #ifndef GCP_UTIL_OFFSETMSG_H
Mode
Definition: OffsetMsg.h:30
Definition: OffsetMsg.h:14
union gcp::util::OffsetMsg::@243 body
Type
Definition: OffsetMsg.h:20
Axis
Definition: OffsetMsg.h:41