Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKIGTLMESSAGEFACTORYH_HEADER_INCLUDED_
18 #define MITKIGTLMESSAGEFACTORYH_HEADER_INCLUDED_
19 
20 #include "MitkOpenIGTLinkExports.h"
21 #include "mitkCommon.h"
22 
23 #include "igtlMessageBase.h"
24 #include "igtlMessageHeader.h"
25 
27 
28 namespace mitk {
37  class MITKOPENIGTLINK_EXPORT IGTLMessageFactory : public itk::Object
38  {
39  public:
41  itkFactorylessNewMacro(Self);
42  itkCloneMacro(Self);
43 
48  typedef igtl::MessageBase::Pointer (*PointerToMessageBaseNew)();
49 
58  void AddMessageType(std::string messageTypeName,
59  IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer,
61 
70  virtual void AddMessageNewMethod(std::string messageTypeName,
71  IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer);
72 
79  virtual IGTLMessageFactory::PointerToMessageBaseNew GetMessageTypeNewPointer(
80  std::string messageTypeName);
81 
89  igtl::MessageBase::Pointer CreateInstance(std::string messageTypeName);
90 
98 
105  virtual void AddMessageCloneHandler(std::string msgTypeName,
107 
117  GetCloneHandler(std::string messageTypeName);
118 
126 
130  std::list<std::string> GetAvailableMessageRequestTypes();
131 
132  protected:
134  virtual ~IGTLMessageFactory();
135 
139  std::map<std::string,mitk::IGTLMessageCloneHandler::Pointer> m_CloneHandlers;
140 
145  std::map<std::string, PointerToMessageBaseNew> m_NewMethods;
146 
147  private:
149  };
150 }
151 
152 #endif
itk::SmartPointer< Self > Pointer
std::map< std::string, mitk::IGTLMessageCloneHandler::Pointer > m_CloneHandlers
Map igt message types and the Clone() methods.
Pointer Clone() const
std::map< std::string, PointerToMessageBaseNew > m_NewMethods
Map igt message types and the New() static methods of igtl::MessageBase classes.
DataCollection - Class to facilitate loading/accessing structured data.
igtl::MessageBase::Pointer(* PointerToMessageBaseNew)()
Function pointer for storing New() static methods of igtl::MessageBase classes.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
Factory class of supported OpenIGTLink message types.