Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkIGTLMessageFactory.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkIGTLMessageFactory_h
14 #define mitkIGTLMessageFactory_h
15 
16 #include "MitkOpenIGTLinkExports.h"
17 #include "mitkCommon.h"
18 
19 #include "igtlMessageBase.h"
20 #include "igtlMessageHeader.h"
21 
23 
24 namespace mitk {
33  class MITKOPENIGTLINK_EXPORT IGTLMessageFactory : public itk::Object
34  {
35  public:
37  itkFactorylessNewMacro(Self);
38  itkCloneMacro(Self);
39 
44  typedef igtl::MessageBase::Pointer (*PointerToMessageBaseNew)();
45 
54  void AddMessageType(std::string messageTypeName,
55  IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer,
56  mitk::IGTLMessageCloneHandler::Pointer cloneHandler);
57 
66  virtual void AddMessageNewMethod(std::string messageTypeName,
67  IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer);
68 
75  virtual IGTLMessageFactory::PointerToMessageBaseNew GetMessageTypeNewPointer(
76  std::string messageTypeName);
77 
85  igtl::MessageBase::Pointer CreateInstance(std::string messageTypeName);
86 
93  igtl::MessageBase::Pointer CreateInstance(igtl::MessageHeader::Pointer msg);
94 
101  virtual void AddMessageCloneHandler(std::string msgTypeName,
102  mitk::IGTLMessageCloneHandler::Pointer msgCloneHandler);
103 
112  virtual mitk::IGTLMessageCloneHandler::Pointer
113  GetCloneHandler(std::string messageTypeName);
114 
121  igtl::MessageBase::Pointer Clone(igtl::MessageBase::Pointer msg);
122 
126  std::list<std::string> GetAvailableMessageRequestTypes();
127 
128  protected:
130  ~IGTLMessageFactory() override;
131 
135  std::map<std::string,mitk::IGTLMessageCloneHandler::Pointer> m_CloneHandlers;
136 
141  std::map<std::string, PointerToMessageBaseNew> m_NewMethods;
142 
143  private:
145  };
146 }
147 
148 #endif
mitk::IGTLMessageFactory::m_NewMethods
std::map< std::string, PointerToMessageBaseNew > m_NewMethods
Map igt message types and the New() static methods of igtl::MessageBase classes.
Definition: mitkIGTLMessageFactory.h:141
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitkCommon.h
mitk::IGTLMessageFactory::m_CloneHandlers
std::map< std::string, mitk::IGTLMessageCloneHandler::Pointer > m_CloneHandlers
Map igt message types and the Clone() methods.
Definition: mitkIGTLMessageFactory.h:135
mitk::IGTLMessageFactory
Factory class of supported OpenIGTLink message types.
Definition: mitkIGTLMessageFactory.h:33
mitkIGTLMessageCloneHandler.h
mitk::IGTLMessageFactory::PointerToMessageBaseNew
igtl::MessageBase::Pointer(* PointerToMessageBaseNew)()
Function pointer for storing New() static methods of igtl::MessageBase classes.
Definition: mitkIGTLMessageFactory.h:44