Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Factory class of supported OpenIGTLink message types. More...
#include <mitkIGTLMessageFactory.h>
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) static Pointer New() | |
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 NULL 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 NULL 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... | |
Protected Member Functions | |
IGTLMessageFactory () | |
virtual | ~IGTLMessageFactory () |
Protected Attributes | |
std::map< std::string, mitk::IGTLMessageCloneHandler::Pointer > | m_CloneHandlers |
Map igt message types and the Clone() methods. More... | |
std::map< std::string, PointerToMessageBaseNew > | m_NewMethods |
Map igt message types and the New() static methods of igtl::MessageBase classes. More... | |
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 37 of file mitkIGTLMessageFactory.h.
typedef igtl::MessageBase::Pointer(* mitk::IGTLMessageFactory::PointerToMessageBaseNew) () |
Function pointer for storing New() static methods of igtl::MessageBase classes.
Definition at line 48 of file mitkIGTLMessageFactory.h.
|
protected |
Definition at line 98 of file mitkIGTLMessageFactory.cpp.
References AddMessageNewMethod(), and mitk::New().
|
protectedvirtual |
Definition at line 164 of file mitkIGTLMessageFactory.cpp.
|
virtual |
Adds a clone function for the specified message type.
msgTypeName | The name of the message type |
msgCloneHandler | Function pointer to the message clone function (e.g. TBD ) |
Definition at line 182 of file mitkIGTLMessageFactory.cpp.
|
virtual |
Add message type name and pointer to IGTL message new function Usage: AddMessageType("IMAGE", (PointerToMessageBaseNew)&igtl::ImageMessage::New);.
messageTypeName | The name of the message type |
messageTypeNewPointer | Function pointer to the message type new function (e.g. (PointerToMessageBaseNew)&igtl::ImageMessage::New ) |
Definition at line 176 of file mitkIGTLMessageFactory.cpp.
Referenced by IGTLMessageFactory().
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.
messageTypeName | The name of the message type |
messageTypeNewPointer | Function pointer to the message type new function (e.g. (PointerToMessageBaseNew)&igtl::ImageMessage::New ) |
cloneHandler | pointer to the message clone object |
Definition at line 168 of file mitkIGTLMessageFactory.cpp.
Pointer mitk::IGTLMessageFactory::Clone | ( | ) | const |
igtl::MessageBase::Pointer mitk::IGTLMessageFactory::Clone | ( | igtl::MessageBase::Pointer | msg | ) |
Clones the given message according to the available clone methods.
msg | The message that has to be cloned This method checks the data type and clones the message according to this type. |
Definition at line 206 of file mitkIGTLMessageFactory.cpp.
References mitk::Clone().
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 NULL Usage: igtl::MessageBase::Pointer message = CreateInstance("IMAGE");
Definition at line 225 of file mitkIGTLMessageFactory.cpp.
igtl::MessageBase::Pointer mitk::IGTLMessageFactory::CreateInstance | ( | igtl::MessageHeader::Pointer | msg | ) |
Creates a new message according to the given header.
msg | The message header that defines the type of the message This method checks the data type and creates a new message according to the type. |
Definition at line 260 of file mitkIGTLMessageFactory.cpp.
References MITK_ERROR.
std::list< std::string > mitk::IGTLMessageFactory::GetAvailableMessageRequestTypes | ( | ) |
Returns available get messages.
Definition at line 240 of file mitkIGTLMessageFactory.cpp.
|
virtual |
Get pointer to message type clone function, or NULL if the message type is not registered Usage: igtl::TransformMessage::Pointer original = igtl::TransformMessage::New(); igtl::MessageBase::Pointer message = GetCloneHandler("IMAGE")->Clone(original);.
Definition at line 189 of file mitkIGTLMessageFactory.cpp.
References MITK_ERROR, and mitkThrow.
|
virtual |
Get pointer to message type new function, or NULL if the message type not registered Usage: igtl::MessageBase::Pointer message = GetMessageTypeNewPointer("IMAGE")();.
Definition at line 212 of file mitkIGTLMessageFactory.cpp.
References MITK_ERROR.
mitk::IGTLMessageFactory::mitkClassMacroItkParent | ( | IGTLMessageFactory | , |
itk::Object | |||
) |
|
protected |
Map igt message types and the Clone() methods.
Definition at line 139 of file mitkIGTLMessageFactory.h.
|
protected |
Map igt message types and the New() static methods of igtl::MessageBase classes.
Definition at line 145 of file mitkIGTLMessageFactory.h.