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 | List of all members
igtl::MessageFactory Class Reference

#include <igtlMessageFactory.h>

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

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef igtl::MessageBase::Pointer(* PointerToMessageBaseNew) ()
 
typedef MessageFactory Self
 
typedef Object Superclass
 

Public Member Functions

virtual void AddMessageType (const std::string &messageTypeName, MessageFactory::PointerToMessageBaseNew messageTypeNewPointer)
 
virtual LightObject::Pointer CreateAnother () const
 
igtl::MessageHeader::Pointer CreateHeaderMessage (int headerVersion) const
 
igtl::MessageBase::Pointer CreateReceiveMessage (igtl::MessageHeader::Pointer headerMsg) const
 
igtl::MessageBase::Pointer CreateSendMessage (const std::string &messageType, int headerVersion) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
virtual void Delete ()
 
void GetAvailableMessageTypes (std::vector< std::string > &types) const
 
bool GetDebug () const
 
igtl::MessageBase::Pointer GetMessage (igtl::MessageHeader::Pointer headerMsg)
 
virtual MessageFactory::PointerToMessageBaseNew GetMessageTypeNewPointer (const std::string &messageTypeName) const
 
virtual const charGetNameOfClass () const
 
virtual int GetReferenceCount () const
 
 igtlTypeMacro (MessageFactory, Object) igtlNewMacro(MessageFactory)
 
 igtlTypeMacro (Object, LightObject)
 
bool IsValid (igtl::MessageHeader::Pointer headerMsg)
 
bool IsValid (igtl::MessageHeader::Pointer headerMsg) const
 
void Print (std::ostream &os) const
 
virtual void Register () const
 
void SetDebug (bool debugFlag) const
 
virtual void SetReferenceCount (int)
 
virtual void UnRegister () const
 

Static Public Member Functions

static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

 MessageFactory ()
 
 ~MessageFactory ()
 
virtual void PrintSelf (std::ostream &os) const
 
static void SetGlobalWarningDisplay (bool flag)
 
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
virtual void PrintHeader (std::ostream &os) const
 
virtual void PrintTrailer (std::ostream &os) const
 
volatile int m_ReferenceCount
 
SimpleFastMutexLock m_ReferenceCountLock
 

Detailed Description

Definition at line 28 of file igtlMessageFactory.h.

Member Typedef Documentation

◆ ConstPointer

Definition at line 35 of file igtlMessageFactory.h.

◆ Pointer

Definition at line 34 of file igtlMessageFactory.h.

◆ PointerToMessageBaseNew

typedef igtl::MessageBase::Pointer(* igtl::MessageFactory::PointerToMessageBaseNew) ()

Function pointer for storing New() static methods of igtl::MessageBase classes

Definition at line 41 of file igtlMessageFactory.h.

◆ Self

Definition at line 32 of file igtlMessageFactory.h.

◆ Superclass

Definition at line 33 of file igtlMessageFactory.h.

Constructor & Destructor Documentation

◆ MessageFactory()

igtl::MessageFactory::MessageFactory ( )
protected

◆ ~MessageFactory()

igtl::MessageFactory::~MessageFactory ( )
protected

Member Function Documentation

◆ AddMessageType()

virtual void igtl::MessageFactory::AddMessageType ( const std::string &  messageTypeName,
MessageFactory::PointerToMessageBaseNew  messageTypeNewPointer 
)
virtual

Add message type name and pointer to IGTL message new function Usage: AddMessageType( "IMAGE", (PointerToMessageBaseNew)&igtl::ImageMessage::New );

Parameters
messageTypeNameThe name of the message type
messageTypeNewPointerFunction pointer to the message type new function (e.g. (PointerToMessageBaseNew)&igtl::ImageMessage::New )

◆ BreakOnError()

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

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

◆ CreateAnother()

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.

◆ CreateHeaderMessage()

igtl::MessageHeader::Pointer igtl::MessageFactory::CreateHeaderMessage ( int  headerVersion) const

Constructs a message header. Throws invalid_argument if headerMsg is NULL. Throws invalid_argument if this->IsValid(headerMsg) returns false. Creates message, calls InitBuffer()

◆ CreateReceiveMessage()

igtl::MessageBase::Pointer igtl::MessageFactory::CreateReceiveMessage ( igtl::MessageHeader::Pointer  headerMsg) const

Constructs a message from the given populated header. Throws invalid_argument if headerMsg is NULL. Throws invalid_argument if this->IsValid(headerMsg) returns false. Creates message, sets header onto message and calls AllocatePack() on the message.

◆ CreateSendMessage()

igtl::MessageBase::Pointer igtl::MessageFactory::CreateSendMessage ( const std::string &  messageType,
int  headerVersion 
) const

Constructs an empty message from the given message type. Throws invalid_argument if messageType is empty. Creates message, sets header onto message and calls AllocatePack() on the message.

◆ DebugOff()

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

Turn debugging output off.

◆ DebugOn()

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

Turn debugging output on.

◆ Delete()

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.

◆ GetAvailableMessageTypes()

void igtl::MessageFactory::GetAvailableMessageTypes ( std::vector< std::string > &  types) const

Return the list of known message types.

◆ GetDebug()

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

Get the value of the debug flag.

◆ GetGlobalWarningDisplay()

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

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.

◆ GetMessage()

igtl::MessageBase::Pointer igtl::MessageFactory::GetMessage ( igtl::MessageHeader::Pointer  headerMsg)

LEGACY method, use CreateReceiveMessage instead Constructs a message from the given header. Throws invalid_argument if headerMsg is NULL. Throws invalid_argument if this->IsValid(headerMsg) returns false. Creates message, sets header onto message and calls AllocateBuffer() on the message.

◆ GetMessageTypeNewPointer()

virtual MessageFactory::PointerToMessageBaseNew igtl::MessageFactory::GetMessageTypeNewPointer ( const std::string &  messageTypeName) const
virtual

Get pointer to message type new function, or NULL if the message type not registered Usage: igtl::MessageBase::Pointer message = GetMessageTypeNewPointer("IMAGE")(); Throws invalid_argument if message type is not found

◆ GetNameOfClass()

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.

◆ GetReferenceCount()

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

Gets the reference count on this object.

Definition at line 110 of file igtlLightObject.h.

◆ GlobalWarningDisplayOff()

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

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.

Definition at line 116 of file igtlObject.h.

◆ GlobalWarningDisplayOn()

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

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.

Definition at line 114 of file igtlObject.h.

◆ igtlTypeMacro() [1/2]

igtl::MessageFactory::igtlTypeMacro ( MessageFactory  ,
Object   
)

◆ igtlTypeMacro() [2/2]

igtl::Object::igtlTypeMacro ( Object  ,
LightObject   
)
inherited

Standard part of all igtl objects.

◆ IsValid() [1/2]

bool igtl::MessageFactory::IsValid ( igtl::MessageHeader::Pointer  headerMsg)

Checks that headerMsg is not null and the headerMsg->GetDeviceType() refers to a valid type, returning true if valid, and false otherwise.

◆ IsValid() [2/2]

bool igtl::MessageFactory::IsValid ( igtl::MessageHeader::Pointer  headerMsg) const

Checks that headerMsg is not null and the headerMsg->GetDeviceType() refers to a valid type, returning true if valid, and false otherwise.

◆ New()

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

Method for creation through the object factory.

◆ Print()

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

Cause the object to print itself out.

◆ PrintHeader()

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

Number of uses of this object by other objects.

◆ PrintSelf()

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::ClientSocket, igtl::FastMutexLock, igtl::MultiThreader, igtl::MutexLock, igtl::ObjectFactoryBase, igtl::ServerSocket, igtl::Socket, and igtl::TimeStamp.

◆ PrintTrailer()

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

Number of uses of this object by other objects.

◆ Register()

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.

◆ SetDebug()

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

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

◆ SetGlobalWarningDisplay()

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

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

◆ SetReferenceCount()

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

Sets the reference count (use with care)

Reimplemented from igtl::LightObject.

◆ UnRegister()

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

Decrease the reference count (release by another object).

Reimplemented from igtl::LightObject.

Member Data Documentation

◆ m_ReferenceCount

volatile int igtl::LightObject::m_ReferenceCount
mutableprotectedinherited

Number of uses of this object by other objects.

Definition at line 131 of file igtlLightObject.h.

◆ m_ReferenceCountLock

SimpleFastMutexLock igtl::LightObject::m_ReferenceCountLock
mutableprotectedinherited

Mutex lock to protect modification to the reference count

Definition at line 134 of file igtlLightObject.h.


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

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