Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlBindMessage.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: The OpenIGTLink Library
4  Language: C++
5  Web page: http://openigtlink.org/
6 
7  Copyright (c) Insight Software Consortium. All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 =========================================================================*/
14 
15 #ifndef __igtlBindMessage_h
16 #define __igtlBindMessage_h
17 
18 #include <string>
19 
20 #include "igtlObject.h"
21 #include "igtlMath.h"
22 #include "igtlMessageBase.h"
23 #include "igtlTypes.h"
24 
25 namespace igtl
26 {
31 {
32 public:
37 
40 
41 public:
42 
44  void Init();
45 
48  int SetNumberOfChildMessages(unsigned int n);
49 
51  int GetNumberOfChildMessages();
52 
56  int AppendChildMessage(igtl::MessageBase * child);
57 
60  int SetChildMessage(unsigned int i, igtl::MessageBase * child);
61 
63  const char* GetChildMessageType(unsigned int i);
64 
65 protected:
66 
68  ~BindMessageBase();
69 
70 protected:
71 
75  typedef struct {
76  std::string type;
77  std::string name;
78  igtlUint64 size;
79  void * ptr;
81 
83  std::vector<ChildMessageInfo> m_ChildMessages;
84 
85 };
86 
87 
90 {
91 public:
92  typedef BindMessage Self;
96 
99 
100 public:
101 
105  int GetChildMessage(unsigned int i, igtl::MessageBase * child);
106 
107 protected:
108  BindMessage();
109  ~BindMessage();
110 
111 protected:
112 
113  virtual int GetBodyPackSize();
114  virtual int PackBody();
115  virtual int UnpackBody();
116 
117 };
118 
119 
124 {
125 public:
130 
133 
134 public:
135 
139  int AppendChildMessage(const char * type, const char * name);
140 
141 protected:
142  GetBindMessage();
143  ~GetBindMessage();
144 
145 protected:
146 
147  virtual int GetBodyPackSize();
148  virtual int PackBody();
149  virtual int UnpackBody();
150 
151 };
152 
153 
158 {
159 public:
164 
167 
168 public:
169 
172  void SetResolution(igtlUint64 res);
173 
176  igtlUint64 GetResolution();
177 
178 protected:
180  ~StartBindMessage();
181 
182 protected:
183 
184  virtual int GetBodyPackSize();
185  virtual int PackBody();
186  virtual int UnpackBody();
187 
188  igtlUint64 m_Resolution;
189 
190 };
191 
192 
196 {
197 public:
202 
205 
206 protected:
207  StopBindMessage() : MessageBase() { this->m_DefaultBodyType = "STP_BIND"; };
209 
210 protected:
211  virtual int GetBodyPackSize() { return 0; };
212  virtual int PackBody() { AllocatePack(); return 1; };
213  virtual int UnpackBody() { return 1; };
214 
215 };
216 
217 
221 {
222 public:
227 
228  // Status type
229  enum {
230  STATUS_SUCCESS = 0,
231  STATUS_ERROR = 1
232  };
233 
236 
238  void SetStatus(igtlUint8 status){ this->m_Status = status; }
239 
241  igtlUint8 GetStatus() { return this->m_Status; };
242 
243 protected:
244  RTSBindMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_BIND"; };
246 
248  igtlUint8 m_Status;
249 
250 protected:
251  virtual int GetBodyPackSize();
252  virtual int PackBody();
253  virtual int UnpackBody();
254 
255 };
256 
257 
258 
259 } // namespace igtl
260 
261 #endif // _igtlBindMessage_h
262 
263 
264 
SmartPointer< const Self > ConstPointer
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
SmartPointer< Self > Pointer
BindMessageBase Superclass
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
SmartPointer< Self > Pointer
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
SmartPointer< Self > Pointer
BindMessageBase Superclass
void SetStatus(igtlUint8 status)
Sets the status for the start/stop request. &#39;status&#39; must be either RTSBindMessage::STATUS_SUCCESS or...
SmartPointer< Self > Pointer
#define IGTLCommon_EXPORT
GetBindMessage Superclass
igtlUint8 GetStatus()
Gets the status for the start/stop request. &#39;status&#39; must be either RTSBindMessage::STATUS_SUCCESS or...
virtual int GetBodyPackSize()
Gets the size of the serialized body.
SmartPointer< const Self > ConstPointer
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
SmartPointer< const Self > ConstPointer
StopBindMessage Self
BindMessageBase Self
StartBindMessage Self
SmartPointer< const Self > ConstPointer
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
A class for the BIND message type.
SmartPointer< Self > Pointer
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
SmartPointer< const Self > ConstPointer
std::vector< ChildMessageInfo > m_ChildMessages
A vector to manage a list of ChildMessageInfo structures.

Generated for OpenIGTLink by Doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2012