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
25namespace igtl
26{
31{
32public:
37
40
41public:
42
44 void Init();
45
48 int SetNumberOfChildMessages(unsigned int n);
49
52
57
60 int SetChildMessage(unsigned int i, igtl::MessageBase * child);
61
63 const char* GetChildMessageType(unsigned int i);
64
65protected:
66
69
70protected:
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{
91public:
96
99
100public:
101
105 int GetChildMessage(unsigned int i, igtl::MessageBase * child);
106
107protected:
110
111protected:
112
113 virtual int GetBodyPackSize();
114 virtual int PackBody();
115 virtual int UnpackBody();
116
117};
118
119
124{
125public:
130
133
134public:
135
139 int AppendChildMessage(const char * type, const char * name);
140
141protected:
144
145protected:
146
147 virtual int GetBodyPackSize();
148 virtual int PackBody();
149 virtual int UnpackBody();
150
151};
152
153
158{
159public:
164
167
168public:
169
172 void SetResolution(igtlUint64 res);
173
176 igtlUint64 GetResolution();
177
178protected:
181
182protected:
183
184 virtual int GetBodyPackSize();
185 virtual int PackBody();
186 virtual int UnpackBody();
187
188 igtlUint64 m_Resolution;
189
190};
191
192
196{
197public:
202
205
206protected:
207 StopBindMessage() : MessageBase() { this->m_DefaultBodyType = "STP_BIND"; };
209
210protected:
211 virtual int GetBodyPackSize() { return 0; };
212 virtual int PackBody() { AllocatePack(); return 1; };
213 virtual int UnpackBody() { return 1; };
214
215};
216
217
221{
222public:
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
243protected:
244 RTSBindMessage() : MessageBase(), m_Status(0) { this->m_DefaultBodyType = "RTS_BIND"; };
246
248 igtlUint8 m_Status;
249
250protected:
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
int AppendChildMessage(igtl::MessageBase *child)
int SetNumberOfChildMessages(unsigned int n)
SmartPointer< Self > Pointer
igtlNewMacro(igtl::BindMessageBase)
void Init()
Initializes the BindMessageBase class.
int SetChildMessage(unsigned int i, igtl::MessageBase *child)
const char * GetChildMessageType(unsigned int i)
Gets the name of a child message specified by the index 'i'.
igtlTypeMacro(igtl::BindMessageBase, igtl::MessageBase)
std::vector< ChildMessageInfo > m_ChildMessages
A vector to manage a list of ChildMessageInfo structures.
SmartPointer< const Self > ConstPointer
int GetNumberOfChildMessages()
Gets the number of child messages bundled in the message.
A class for the BIND message type.
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
igtlNewMacro(igtl::BindMessage)
igtlTypeMacro(igtl::BindMessage, igtl::BindMessageBase)
SmartPointer< const Self > ConstPointer
int GetChildMessage(unsigned int i, igtl::MessageBase *child)
SmartPointer< Self > Pointer
BindMessageBase Superclass
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
SmartPointer< const Self > ConstPointer
BindMessageBase Superclass
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlNewMacro(igtl::GetBindMessage)
SmartPointer< Self > Pointer
igtlTypeMacro(igtl::GetBindMessage, igtl::BindMessageBase)
int AppendChildMessage(const char *type, const char *name)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
igtlNewMacro(igtl::RTSBindMessage)
igtlTypeMacro(igtl::RTSBindMessage, igtl::MessageBase)
igtlUint8 m_Status
Stores the status for the start/stop request.
SmartPointer< Self > Pointer
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
void SetStatus(igtlUint8 status)
Sets the status for the start/stop request. 'status' must be either RTSBindMessage::STATUS_SUCCESS or...
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlUint8 GetStatus()
Gets the status for the start/stop request. 'status' must be either RTSBindMessage::STATUS_SUCCESS or...
SmartPointer< const Self > ConstPointer
Implements transparent reference counting.
SmartPointer< Self > Pointer
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
igtlNewMacro(igtl::StartBindMessage)
virtual int GetBodyPackSize()
Gets the size of the serialized body.
void SetResolution(igtlUint64 res)
SmartPointer< const Self > ConstPointer
igtlTypeMacro(igtl::StartBindMessage, igtl::GetBindMessage)
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
igtlUint64 GetResolution()
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
SmartPointer< Self > Pointer
igtlNewMacro(igtl::StopBindMessage)
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
SmartPointer< const Self > ConstPointer
virtual int GetBodyPackSize()
Gets the size of the serialized body.
igtlTypeMacro(igtl::StopBindMessage, igtl::MessageBase)
#define IGTLCommon_EXPORT
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...

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