15#ifndef __igtlMessageBase_h
16#define __igtlMessageBase_h
69 UNPACK_UNDEF = 0x0000,
70 UNPACK_HEADER = 0x0001,
239 virtual int PackBody() { AllocatePack();
return 1; };
248#define igtlCreateDefaultQueryMessageClass(name, msgtype) \
249class IGTLCommon_EXPORT name : public HeaderOnlyMessageBase\
253 typedef HeaderOnlyMessageBase Superclass; \
254 typedef SmartPointer<Self> Pointer; \
255 typedef SmartPointer<const Self> ConstPointer; \
257 igtlTypeMacro(igtl::name, igtl::HeaderOnlyMessageBase); \
258 igtlNewMacro(igtl::name); \
261 name() : HeaderOnlyMessageBase() { this->m_DefaultBodyType = msgtype; }; \
int CopyBody(const MessageBase *mb)
Copies the serialized body data.
unsigned int m_TimeStampSecFraction
int m_IsHeaderUnpacked
Unpacking (desrialization) status for the header (0: – 1: unpacked).
int SetTimeStamp(unsigned int sec, unsigned int frac)
Sets time of message creation. 'sec' and 'frac' are seconds and fractions of a second respectively.
int CopyHeader(const MessageBase *mb)
Copies a header from.
int Unpack(int crccheck=0)
int GetPackBodySize()
Gets the size of the serialized body data.
void SetDeviceName(const char *name)
Sets the device (message) name.
unsigned int m_TimeStampSec
void SetTimeStamp(igtl::TimeStamp::Pointer &ts)
Sets time of message creation.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
virtual void AllocatePack(int bodySize)
const char * GetBodyType()
GetBodyType() gets the type of the body.
std::string m_DeviceName
A character string for the device name (message name).
void * GetPackBodyPointer()
Gets a pointer to the raw byte array for the serialized body data.
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
int Copy(const MessageBase *mb)
const char * GetDeviceType()
Gets the device (message) type.
int GetPackSize()
Gets the size of the serialized data.
void AllocatePack()
AllocatePack() allocates memory for packing / receiving buffer.
const char * GetDeviceName()
Gets the device (message) name.
void GetTimeStamp(igtl::TimeStamp::Pointer &ts)
Gets time of message creation.
int GetTimeStamp(unsigned int *sec, unsigned int *frac)
Gets time of message creation. 'sec' and 'frac' are seconds and fractions of a second respectively.
virtual int SetMessageHeader(const MessageHeader *mb)
Sets the message header.
int m_IsBodyUnpacked
Unpacking (desrialization) status for the body (0: – 1: unpacked).
void * GetPackPointer()
Gets a pointer to the raw byte array for the serialized data including the header and the body.
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
std::string m_DefaultBodyType
A character string for the default device type (message type).
Base class for most igtl classes.
Implements transparent reference counting.
#define igtlTypeMacro(thisClass, superclass)
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
class MessageBase MessageHeader