Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitk::IGTLMessageFactory Class Reference

Factory class of supported OpenIGTLink message types. More...

#include <mitkIGTLMessageFactory.h>

Inheritance diagram for mitk::IGTLMessageFactory:
Collaboration diagram for mitk::IGTLMessageFactory:

Public Types

typedef igtl::MessageBase::Pointer(* PointerToMessageBaseNew) ()
 Function pointer for storing New() static methods of igtl::MessageBase classes. More...
 

Public Member Functions

 mitkClassMacroItkParent (IGTLMessageFactory, itk::Object)
 
Pointer Clone () const
 
void AddMessageType (std::string messageTypeName, IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer, mitk::IGTLMessageCloneHandler::Pointer cloneHandler)
 Add message type name and pointer to IGTL message new function and the clone handler. More...
 
virtual void AddMessageNewMethod (std::string messageTypeName, IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer)
 Add message type name and pointer to IGTL message new function Usage: AddMessageType("IMAGE", (PointerToMessageBaseNew)&igtl::ImageMessage::New);. More...
 
virtual IGTLMessageFactory::PointerToMessageBaseNew GetMessageTypeNewPointer (std::string messageTypeName)
 Get pointer to message type new function, or nullptr if the message type not registered Usage: igtl::MessageBase::Pointer message = GetMessageTypeNewPointer("IMAGE")();. More...
 
igtl::MessageBase::Pointer CreateInstance (std::string messageTypeName)
 Creates a new message instance fitting to the given type. More...
 
igtl::MessageBase::Pointer CreateInstance (igtl::MessageHeader::Pointer msg)
 Creates a new message according to the given header. More...
 
virtual void AddMessageCloneHandler (std::string msgTypeName, mitk::IGTLMessageCloneHandler::Pointer msgCloneHandler)
 Adds a clone function for the specified message type. More...
 
virtual mitk::IGTLMessageCloneHandler::Pointer GetCloneHandler (std::string messageTypeName)
 Get pointer to message type clone function, or nullptr if the message type is not registered Usage: igtl::TransformMessage::Pointer original = igtl::TransformMessage::New(); igtl::MessageBase::Pointer message = GetCloneHandler("IMAGE")->Clone(original);. More...
 
igtl::MessageBase::Pointer Clone (igtl::MessageBase::Pointer msg)
 Clones the given message according to the available clone methods. More...
 
std::list< std::string > GetAvailableMessageRequestTypes ()
 Returns available get messages. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 IGTLMessageFactory ()
 
 ~IGTLMessageFactory () override
 

Protected Attributes

std::map< std::string, mitk::IGTLMessageCloneHandler::Pointer > m_CloneHandlers
 Map igt message types and the Clone() methods. More...
 
std::map< std::string, PointerToMessageBaseNewm_NewMethods
 Map igt message types and the New() static methods of igtl::MessageBase classes. More...
 

Detailed Description

Factory class of supported OpenIGTLink message types.

This class is a factory for the creation of OpenIGTLink messages. It stores pairs of type and pointer to the message new method. Available standard types are already added but you can also add your custom types at runtime.

Definition at line 33 of file mitkIGTLMessageFactory.h.

Member Typedef Documentation

◆ PointerToMessageBaseNew

typedef igtl::MessageBase::Pointer(* mitk::IGTLMessageFactory::PointerToMessageBaseNew) ()

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

Definition at line 44 of file mitkIGTLMessageFactory.h.

Constructor & Destructor Documentation

◆ IGTLMessageFactory()

mitk::IGTLMessageFactory::IGTLMessageFactory ( )
protected

◆ ~IGTLMessageFactory()

mitk::IGTLMessageFactory::~IGTLMessageFactory ( )
overrideprotected

Member Function Documentation

◆ AddMessageCloneHandler()

virtual void mitk::IGTLMessageFactory::AddMessageCloneHandler ( std::string  msgTypeName,
mitk::IGTLMessageCloneHandler::Pointer  msgCloneHandler 
)
virtual

Adds a clone function for the specified message type.

Parameters
msgTypeNameThe name of the message type
msgCloneHandlerFunction pointer to the message clone function (e.g. TBD )

◆ AddMessageNewMethod()

virtual void mitk::IGTLMessageFactory::AddMessageNewMethod ( std::string  messageTypeName,
IGTLMessageFactory::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 )

◆ AddMessageType()

void mitk::IGTLMessageFactory::AddMessageType ( std::string  messageTypeName,
IGTLMessageFactory::PointerToMessageBaseNew  messageTypeNewPointer,
mitk::IGTLMessageCloneHandler::Pointer  cloneHandler 
)

Add message type name and pointer to IGTL message new function and the clone handler.

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

◆ Clone() [1/2]

Pointer mitk::IGTLMessageFactory::Clone ( ) const

◆ Clone() [2/2]

igtl::MessageBase::Pointer mitk::IGTLMessageFactory::Clone ( igtl::MessageBase::Pointer  msg)

Clones the given message according to the available clone methods.

Parameters
msgThe message that has to be cloned This method checks the data type and clones the message according to this type.

◆ CreateInstance() [1/2]

igtl::MessageBase::Pointer mitk::IGTLMessageFactory::CreateInstance ( igtl::MessageHeader::Pointer  msg)

Creates a new message according to the given header.

Parameters
msgThe message header that defines the type of the message This method checks the data type and creates a new message according to the type.

◆ CreateInstance() [2/2]

igtl::MessageBase::Pointer mitk::IGTLMessageFactory::CreateInstance ( std::string  messageTypeName)

Creates a new message instance fitting to the given type.

If this type is not registered it returns nullptr Usage: igtl::MessageBase::Pointer message = CreateInstance("IMAGE");

◆ GetAvailableMessageRequestTypes()

std::list<std::string> mitk::IGTLMessageFactory::GetAvailableMessageRequestTypes ( )

Returns available get messages.

◆ GetCloneHandler()

virtual mitk::IGTLMessageCloneHandler::Pointer mitk::IGTLMessageFactory::GetCloneHandler ( std::string  messageTypeName)
virtual

Get pointer to message type clone function, or nullptr if the message type is not registered Usage: igtl::TransformMessage::Pointer original = igtl::TransformMessage::New(); igtl::MessageBase::Pointer message = GetCloneHandler("IMAGE")->Clone(original);.

◆ GetMessageTypeNewPointer()

virtual IGTLMessageFactory::PointerToMessageBaseNew mitk::IGTLMessageFactory::GetMessageTypeNewPointer ( std::string  messageTypeName)
virtual

Get pointer to message type new function, or nullptr if the message type not registered Usage: igtl::MessageBase::Pointer message = GetMessageTypeNewPointer("IMAGE")();.

◆ mitkClassMacroItkParent()

mitk::IGTLMessageFactory::mitkClassMacroItkParent ( IGTLMessageFactory  ,
itk::Object   
)

◆ New()

static Pointer mitk::IGTLMessageFactory::New ( )
static

Member Data Documentation

◆ m_CloneHandlers

std::map<std::string,mitk::IGTLMessageCloneHandler::Pointer> mitk::IGTLMessageFactory::m_CloneHandlers
protected

Map igt message types and the Clone() methods.

Definition at line 135 of file mitkIGTLMessageFactory.h.

◆ m_NewMethods

std::map<std::string, PointerToMessageBaseNew> mitk::IGTLMessageFactory::m_NewMethods
protected

Map igt message types and the New() static methods of igtl::MessageBase classes.

Definition at line 141 of file mitkIGTLMessageFactory.h.


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