Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
igtl::PositionMessage Class Reference

#include <igtlPositionMessage.h>

Inheritance diagram for igtl::PositionMessage:
Inheritance graph
[legend]
Collaboration diagram for igtl::PositionMessage:
Collaboration graph
[legend]

Public Types

enum  {
  UNPACK_UNDEF = 0x0000,
  UNPACK_HEADER = 0x0001,
  UNPACK_BODY = 0x0002
}
 
enum  {
  POSITION_ONLY = 1,
  WITH_QUATERNION3,
  ALL
}
 
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef PositionMessage Self
 
typedef MessageBase Superclass
 

Public Member Functions

void AllocatePack ()
 
int Copy (const MessageBase *mb)
 
virtual LightObject::Pointer CreateAnother () const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
virtual void Delete ()
 
int GetBodySizeToRead ()
 
const char * GetBodyType ()
 
bool GetDebug () const
 
const char * GetDeviceName ()
 
const char * GetDeviceType ()
 
virtual const char * GetNameOfClass () const
 
void * GetPackBodyPointer ()
 
int GetPackBodySize ()
 
void * GetPackPointer ()
 
int GetPackSize ()
 
int GetPackType ()
 
void GetPosition (float *pos)
 
void GetPosition (float *x, float *y, float *z)
 
void GetQuaternion (float *quat)
 
void GetQuaternion (float *ox, float *oy, float *oz, float *w)
 
virtual int GetReferenceCount () const
 
int GetTimeStamp (unsigned int *sec, unsigned int *frac)
 
void GetTimeStamp (igtl::TimeStamp::Pointer &ts)
 
 igtlNewMacro (igtl::PositionMessage)
 
 igtlNewMacro (igtl::MessageBase)
 
 igtlTypeMacro (igtl::PositionMessage, igtl::MessageBase)
 
 igtlTypeMacro (Object, LightObject)
 
void Init ()
 
void InitPack ()
 
virtual int Pack ()
 
void Print (std::ostream &os) const
 
virtual void Register () const
 
void SetDebug (bool debugFlag) const
 
void SetDeviceName (const char *name)
 
virtual int SetMessageHeader (const MessageHeader *mb)
 
void SetPackType (int t)
 
int SetPackTypeByBodySize (int s)
 
void SetPosition (const float *pos)
 
void SetPosition (float x, float y, float z)
 
void SetQuaternion (const float *quat)
 
void SetQuaternion (float ox, float oy, float oz, float w)
 
virtual void SetReferenceCount (int)
 
int SetTimeStamp (unsigned int sec, unsigned int frac)
 
void SetTimeStamp (igtl::TimeStamp::Pointer &ts)
 
int Unpack (int crccheck=0)
 
virtual void UnRegister () const
 

Static Public Member Functions

static void BreakOnError ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 

Protected Member Functions

virtual void AllocatePack (int bodySize)
 
int CopyBody (const MessageBase *mb)
 
int CopyHeader (const MessageBase *mb)
 
virtual int GetBodyPackSize ()
 
virtual int PackBody ()
 
 PositionMessage ()
 
virtual void PrintSelf (std::ostream &os) const
 
virtual int UnpackBody ()
 
 ~PositionMessage ()
 
virtual void PrintHeader (std::ostream &os) const
 
virtual void PrintTrailer (std::ostream &os) const
 

Protected Attributes

unsigned char * m_Body
 
int m_BodySizeToRead
 
std::string m_BodyType
 
std::string m_DefaultBodyType
 
std::string m_DeviceName
 
unsigned char * m_Header
 
int m_IsBodyUnpacked
 
int m_IsHeaderUnpacked
 
int m_PackSize
 
igtlInt32 m_PackType
 
igtlFloat32 m_Position [3]
 
igtlFloat32 m_Quaternion [4]
 
volatile int m_ReferenceCount
 
SimpleFastMutexLock m_ReferenceCountLock
 
unsigned int m_TimeStampSec
 
unsigned int m_TimeStampSecFraction
 

Detailed Description

The POSITION data type is used to transfer position and orientation information. The data are a combination of 3-dimensional vector for the position and quaternion for the orientation. Although equivalent position and orientation can be described with the TRANSFORM data type, the POSITION data type has the advantage of smaller data size (19%). It is therefore more suitable for pushing high frame-rate data from tracking devices.

Definition at line 32 of file igtlPositionMessage.h.

Member Typedef Documentation

Definition at line 50 of file igtlPositionMessage.h.

Definition at line 49 of file igtlPositionMessage.h.

Definition at line 47 of file igtlPositionMessage.h.

Definition at line 48 of file igtlPositionMessage.h.

Member Enumeration Documentation

anonymous enum
inherited

Unpack status. They are returned by the Unpack() function.

Enumerator
UNPACK_UNDEF 
UNPACK_HEADER 
UNPACK_BODY 

Definition at line 68 of file igtlMessageBase.h.

anonymous enum

Types of message formats. The format of the POSITION message type can contain only a 3-element position vector (POSITION_ONLY), a combination of 3-element position vector and 3-element quaternion (WITH_QUATERNION3), or a combination of 3-element position vector and 4-element quaternion (ALL).

Enumerator
POSITION_ONLY 
WITH_QUATERNION3 
ALL 

Definition at line 40 of file igtlPositionMessage.h.

Constructor & Destructor Documentation

igtl::PositionMessage::PositionMessage ( )
protected
igtl::PositionMessage::~PositionMessage ( )
protected

Member Function Documentation

void igtl::MessageBase::AllocatePack ( )
inherited

AllocatePack() allocates memory for packing / receiving buffer.

virtual void igtl::MessageBase::AllocatePack ( int  bodySize)
protectedvirtualinherited

Allocates memory specifying the body size. This function is used when creating a brank package to receive data)

Reimplemented in igtl::ImageMessage2.

static void igtl::LightObject::BreakOnError ( )
staticinherited

This method is called when igtlExceptionMacro executes. It allows the debugger to break on error.

int igtl::MessageBase::Copy ( const MessageBase mb)
inherited

Copy() copies contents from the specified Massage class. If the type of the specified class is the same as this class, both general header and body are copied. Otherwise, only general header is copied.

int igtl::MessageBase::CopyBody ( const MessageBase mb)
protectedinherited

Copies the serialized body data.

int igtl::MessageBase::CopyHeader ( const MessageBase mb)
protectedinherited

Copies a header from.

virtual LightObject::Pointer igtl::Object::CreateAnother ( ) const
virtualinherited

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from igtl::LightObject.

virtual void igtl::Object::DebugOff ( ) const
virtualinherited

Turn debugging output off.

virtual void igtl::Object::DebugOn ( ) const
virtualinherited

Turn debugging output on.

virtual void igtl::LightObject::Delete ( )
virtualinherited

Delete an igtl object. This method should always be used to delete an object when the new operator was used to create it. Using the C delete method will not work with reference counting.

virtual int igtl::PositionMessage::GetBodyPackSize ( )
protectedvirtual

Gets the size of the serialized body.

Reimplemented from igtl::MessageBase.

int igtl::MessageBase::GetBodySizeToRead ( )
inlineinherited

GetBodySizeToRead() returns the size of the body to be read. This function must be called after the message header is set.

Definition at line 151 of file igtlMessageBase.h.

const char* igtl::MessageBase::GetBodyType ( )
inlineinherited

GetBodyType() gets the type of the body.

Definition at line 130 of file igtlMessageBase.h.

bool igtl::Object::GetDebug ( ) const
inherited

Get the value of the debug flag.

const char* igtl::MessageBase::GetDeviceName ( )
inherited

Gets the device (message) name.

const char* igtl::MessageBase::GetDeviceType ( )
inherited

Gets the device (message) type.

static bool igtl::Object::GetGlobalWarningDisplay ( )
staticinherited

This is a global flag that controls whether any debug, warning or error messages are displayed.

virtual const char* igtl::LightObject::GetNameOfClass ( ) const
inlinevirtualinherited

Return the name of this class as a string. Used by the object factory (implemented in New()) to instantiate objects of a named type. Also used for debugging and other output information.

Definition at line 84 of file igtlLightObject.h.

void* igtl::MessageBase::GetPackBodyPointer ( )
inherited

Gets a pointer to the raw byte array for the serialized body data.

int igtl::MessageBase::GetPackBodySize ( )
inherited

Gets the size of the serialized body data.

void* igtl::MessageBase::GetPackPointer ( )
inherited

Gets a pointer to the raw byte array for the serialized data including the header and the body.

int igtl::MessageBase::GetPackSize ( )
inherited

Gets the size of the serialized data.

int igtl::PositionMessage::GetPackType ( )
inline

Gets the type of the pack. The returned value must be either POSITION_ONLY, WITH_QUATERNION3, or ALL.

Definition at line 64 of file igtlPositionMessage.h.

void igtl::PositionMessage::GetPosition ( float *  pos)

Gets the position. The function substitutes 3-element array of x, y and z coordinates in 'pos'.

void igtl::PositionMessage::GetPosition ( float *  x,
float *  y,
float *  z 
)

Gets the position. The function substitutes the coordinates in 'x', 'y', and 'z'.

void igtl::PositionMessage::GetQuaternion ( float *  quat)

Gets the quaternion. The function substitutes the array of elements of the quaternion in 'quat'.

void igtl::PositionMessage::GetQuaternion ( float *  ox,
float *  oy,
float *  oz,
float *  w 
)

Gets the quaternion. The function substitutes the elements of the quaternion in 'ox', 'oy', 'oz' and 'w'.

virtual int igtl::LightObject::GetReferenceCount ( ) const
inlinevirtualinherited

Gets the reference count on this object.

Definition at line 110 of file igtlLightObject.h.

int igtl::MessageBase::GetTimeStamp ( unsigned int *  sec,
unsigned int *  frac 
)
inherited

Gets time of message creation. 'sec' and 'frac' are seconds and fractions of a second respectively.

void igtl::MessageBase::GetTimeStamp ( igtl::TimeStamp::Pointer ts)
inherited

Gets time of message creation.

static void igtl::Object::GlobalWarningDisplayOff ( )
inlinestaticinherited

This is a global flag that controls whether any debug, warning or error messages are displayed.

Definition at line 116 of file igtlObject.h.

References igtl::Object::SetGlobalWarningDisplay().

static void igtl::Object::GlobalWarningDisplayOn ( )
inlinestaticinherited

This is a global flag that controls whether any debug, warning or error messages are displayed.

Definition at line 114 of file igtlObject.h.

References igtl::Object::SetGlobalWarningDisplay().

igtl::PositionMessage::igtlNewMacro ( igtl::PositionMessage  )
igtl::MessageBase::igtlNewMacro ( igtl::MessageBase  )
inherited
igtl::PositionMessage::igtlTypeMacro ( igtl::PositionMessage  ,
igtl::MessageBase   
)
igtl::Object::igtlTypeMacro ( Object  ,
LightObject   
)
inherited

Standard part of all igtl objects.

void igtl::PositionMessage::Init ( )

Initializes the class.

void igtl::MessageBase::InitPack ( )
inherited

Call InitPack() before receive header. This function simply resets the Unpacked flag for both the header and body pack.

static Pointer igtl::Object::New ( )
staticinherited

Method for creation through the object factory.

virtual int igtl::MessageBase::Pack ( )
virtualinherited

Pack() serializes the header and body based on the member variables. PackBody() must be implemented in the child class.

Reimplemented in igtl::ImageMessage2.

virtual int igtl::PositionMessage::PackBody ( )
protectedvirtual

Packs (serialize) the body. Must be implemented in a child class.

Reimplemented from igtl::MessageBase.

void igtl::LightObject::Print ( std::ostream &  os) const
inherited

Cause the object to print itself out.

virtual void igtl::LightObject::PrintHeader ( std::ostream &  os) const
protectedvirtualinherited

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

virtual void igtl::Object::PrintSelf ( std::ostream &  os) const
protectedvirtualinherited

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from igtl::LightObject.

Reimplemented in igtl::MultiThreader, igtl::MutexLock, igtl::ObjectFactoryBase, igtl::Socket, igtl::FastMutexLock, igtl::TimeStamp, igtl::ServerSocket, and igtl::ClientSocket.

virtual void igtl::LightObject::PrintTrailer ( std::ostream &  os) const
protectedvirtualinherited

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

virtual void igtl::Object::Register ( ) const
virtualinherited

Return this objects modified time. Update the modification time for this object. Many filters rely on the modification time to determine if they need to recompute their data. Increase the reference count (mark as used by another object).

Reimplemented from igtl::LightObject.

void igtl::Object::SetDebug ( bool  debugFlag) const
inherited

Set the value of the debug flag. A non-zero value turns debugging on.

void igtl::MessageBase::SetDeviceName ( const char *  name)
inherited

Sets the device (message) name.

static void igtl::Object::SetGlobalWarningDisplay ( bool  flag)
staticinherited

This is a global flag that controls whether any debug, warning or error messages are displayed.

Referenced by igtl::Object::GlobalWarningDisplayOff(), and igtl::Object::GlobalWarningDisplayOn().

virtual int igtl::PositionMessage::SetMessageHeader ( const MessageHeader mb)
virtual

Sets the message header.

Reimplemented from igtl::MessageBase.

void igtl::PositionMessage::SetPackType ( int  t)

Sets the type of the pack. 't' must be either POSITION_ONLY, WITH_QUATERNION3, or ALL.

int igtl::PositionMessage::SetPackTypeByBodySize ( int  s)

Specifies the pack type by body size (in most case obtained from general header).

void igtl::PositionMessage::SetPosition ( const float *  pos)

Sets the position by 3-element array of x, y, and z coordinates.

void igtl::PositionMessage::SetPosition ( float  x,
float  y,
float  z 
)

Sets the position by x, y, and z coordinates.

void igtl::PositionMessage::SetQuaternion ( const float *  quat)

Sets the quaternion by 4-element array.

void igtl::PositionMessage::SetQuaternion ( float  ox,
float  oy,
float  oz,
float  w 
)

Sets the quaternion by elements of the quaternion (ox, oy, oz and w).

virtual void igtl::Object::SetReferenceCount ( int  )
virtualinherited

Sets the reference count (use with care)

Reimplemented from igtl::LightObject.

int igtl::MessageBase::SetTimeStamp ( unsigned int  sec,
unsigned int  frac 
)
inherited

Sets time of message creation. 'sec' and 'frac' are seconds and fractions of a second respectively.

void igtl::MessageBase::SetTimeStamp ( igtl::TimeStamp::Pointer ts)
inherited

Sets time of message creation.

int igtl::MessageBase::Unpack ( int  crccheck = 0)
inherited

Unpack() deserializes the header and/or body, extracting data from the byte stream. If the header has already been deserilized, Unpack() deserializes only the body part. UnpackBody() must be implemented to deserialize the body part. Unpack() performs 64-bit CRC check, when crccheck = 1. It returns:

UNPACK_UNDEF : Nothing deserialized UNPACK_HEADER : The header has been deserialized. UNPACK_BODY : The body has been deserialized. If CRC check fails, Unpack() doesn't deserialize the body, thus it doesn't return UNPACK_BODY flag. UNPACK_HEADER|UNPACK_BODY: Both the header and body have been deserialized

virtual int igtl::PositionMessage::UnpackBody ( )
protectedvirtual

Unpacks (deserialize) the body. Must be implemented in a child class.

Reimplemented from igtl::MessageBase.

virtual void igtl::Object::UnRegister ( ) const
virtualinherited

Decrease the reference count (release by another object).

Reimplemented from igtl::LightObject.

Member Data Documentation

unsigned char* igtl::MessageBase::m_Body
protectedinherited

A pointer to the byte array for the serialized body. To prevent large copy of the byte array in the Pack() function, header byte array is concatinated to the byte array for the header.

Definition at line 187 of file igtlMessageBase.h.

int igtl::MessageBase::m_BodySizeToRead
protectedinherited

The size of the body to be read. This function must be called after the message header is set.

Definition at line 191 of file igtlMessageBase.h.

std::string igtl::MessageBase::m_BodyType
protectedinherited

A character string for the device type (message type). This will be used when the header is desrialized from a byte stream received from the network.

Definition at line 198 of file igtlMessageBase.h.

std::string igtl::MessageBase::m_DefaultBodyType
protectedinherited

A character string for the default device type (message type).

Definition at line 194 of file igtlMessageBase.h.

std::string igtl::MessageBase::m_DeviceName
protectedinherited

A character string for the device name (message name).

Definition at line 201 of file igtlMessageBase.h.

unsigned char* igtl::MessageBase::m_Header
protectedinherited

A pointer to the byte array for the serialized header. To prevent large copy of the byte array in the Pack() function, header byte array is concatinated to the byte array for the body.

Definition at line 182 of file igtlMessageBase.h.

int igtl::MessageBase::m_IsBodyUnpacked
protectedinherited

Unpacking (desrialization) status for the body (0: – 1: unpacked).

Definition at line 215 of file igtlMessageBase.h.

int igtl::MessageBase::m_IsHeaderUnpacked
protectedinherited

Unpacking (desrialization) status for the header (0: – 1: unpacked).

Definition at line 212 of file igtlMessageBase.h.

int igtl::MessageBase::m_PackSize
protectedinherited

Definition at line 177 of file igtlMessageBase.h.

igtlInt32 igtl::PositionMessage::m_PackType
protected

The type of message formats (either POSITION_ONLY, WITH_QUATERNION3, or ALL).

Definition at line 108 of file igtlPositionMessage.h.

igtlFloat32 igtl::PositionMessage::m_Position[3]
protected

An array of x, y, and z coordinates for the position.

Definition at line 111 of file igtlPositionMessage.h.

igtlFloat32 igtl::PositionMessage::m_Quaternion[4]
protected

An array of ox, oy, oz, and w elements for the quaternion.

Definition at line 114 of file igtlPositionMessage.h.

volatile int igtl::LightObject::m_ReferenceCount
mutableprotectedinherited

Number of uses of this object by other objects.

Definition at line 131 of file igtlLightObject.h.

SimpleFastMutexLock igtl::LightObject::m_ReferenceCountLock
mutableprotectedinherited

Mutex lock to protect modification to the reference count

Definition at line 134 of file igtlLightObject.h.

unsigned int igtl::MessageBase::m_TimeStampSec
protectedinherited

A time stamp (second) for message creation. It consists of fields for seconds (m_TimeStampSec)and franctions of a second (m_TimeStampSecFraction).

Definition at line 205 of file igtlMessageBase.h.

unsigned int igtl::MessageBase::m_TimeStampSecFraction
protectedinherited

A time stamp (second) for message creation. It consists of fields for seconds (m_TimeStampSec)and franctions of a second (m_TimeStampSecFraction).

Definition at line 209 of file igtlMessageBase.h.


The documentation for this class was generated from the following file:

Generated at Wed Dec 4 2013 11:11:32 for OpenIGTLink by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2012