PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusIgtlMessageFactory.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2  Program: Plus
3  Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4  See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef __vtkPlusIgtlMessageFactory_h
8 #define __vtkPlusIgtlMessageFactory_h
9 
10 #include "PlusConfigure.h"
11 #include "vtkPlusOpenIGTLinkExport.h"
12 
13 // VTK includes
14 #include "vtkObject.h"
15 
16 // OpenIGTLink includes
17 #include "igtlMessageBase.h"
18 #include "igtlMessageFactory.h"
19 
20 // PlusLib includes
21 #include "PlusIgtlClientInfo.h"
22 
23 class vtkXMLDataElement;
24 //class igsioTrackedFrame;
25 //class vtkIGSIOTransformRepository;
26 
35 class vtkPlusOpenIGTLinkExport vtkPlusIgtlMessageFactory: public vtkObject
36 {
37 public:
38  static vtkPlusIgtlMessageFactory* New();
39  vtkTypeMacro(vtkPlusIgtlMessageFactory, vtkObject);
40  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
41 
43  typedef igtl::MessageBase::Pointer (*PointerToMessageBaseNew)();
44 
49  virtual vtkPlusIgtlMessageFactory::PointerToMessageBaseNew GetMessageTypeNewPointer(const std::string& messageTypeName);
50 
52  virtual void PrintAvailableMessageTypes(ostream& os, vtkIndent indent);
53 
58  igtl::MessageHeader::Pointer CreateHeaderMessage(int headerVersion) const;
59 
64  igtl::MessageBase::Pointer CreateReceiveMessage(igtl::MessageHeader::Pointer headerMsg) const;
65 
69  igtl::MessageBase::Pointer CreateSendMessage(const std::string& messageType, int headerVersion) const;
70 
80  PlusStatus PackMessages(int clientId, const PlusIgtlClientInfo& clientInfo, std::vector<igtl::MessageBase::Pointer>& igtMessages, igsioTrackedFrame& trackedFrame,
81  bool packValidTransformsOnly, vtkIGSIOTransformRepository* transformRepository = NULL);
82 
83 protected:
85  virtual ~vtkPlusIgtlMessageFactory();
86 
87  igtl::MessageFactory::Pointer IgtlFactory;
88 
89 protected:
90  int PackImageMessage(const PlusIgtlClientInfo& clientInfo, vtkIGSIOTransformRepository& transformRepository, const std::string& messageType,
91  igtl::MessageBase::Pointer igtlMessage, igsioTrackedFrame& trackedFrame, std::vector<igtl::MessageBase::Pointer>& igtlMessages, int clientId);
92 #if defined(OpenIGTLink_ENABLE_VIDEOSTREAMING)
93  int PackVideoMessage(const PlusIgtlClientInfo& clientInfo, vtkIGSIOTransformRepository& transformRepository, const std::string& messageType,
94  igtl::MessageBase::Pointer igtlMessage, igsioTrackedFrame& trackedFrame, std::vector<igtl::MessageBase::Pointer>& igtlMessages, int clientId);
95 #endif
96  int PackTransformMessage(const PlusIgtlClientInfo& clientInfo, vtkIGSIOTransformRepository& transformRepository, bool packValidTransformsOnly,
97  igtl::MessageBase::Pointer igtlMessage, igsioTrackedFrame& trackedFrame, std::vector<igtl::MessageBase::Pointer>& igtlMessages);
98  int PackTrackingDataMessage(const PlusIgtlClientInfo& clientInfo, igsioTrackedFrame& trackedFrame, vtkIGSIOTransformRepository& transformRepository, bool packValidTransformsOnly,
99  igtl::MessageBase::Pointer igtlMessage, std::vector<igtl::MessageBase::Pointer>& igtlMessages);
100  int PackPositionMessage(const PlusIgtlClientInfo& clientInfo, vtkIGSIOTransformRepository& transformRepository, igtl::MessageBase::Pointer igtlMessage,
101  igsioTrackedFrame& trackedFrame, std::vector<igtl::MessageBase::Pointer>& igtlMessages);
102  int PackTrackedFrameMessage(igtl::MessageBase::Pointer igtlMessage, const PlusIgtlClientInfo& clientInfo, vtkIGSIOTransformRepository& transformRepository,
103  igsioTrackedFrame& trackedFrame, std::vector<igtl::MessageBase::Pointer>& igtlMessages);
104  int PackUsMessage(igtl::MessageBase::Pointer igtlMessage, igsioTrackedFrame& trackedFrame, std::vector<igtl::MessageBase::Pointer>& igtlMessages);
105  int PackStringMessage(const PlusIgtlClientInfo& clientInfo, igsioTrackedFrame& trackedFrame, igtl::MessageBase::Pointer igtlMessage, std::vector<igtl::MessageBase::Pointer>& igtlMessages);
106  int PackCommandMessage(igtl::MessageBase::Pointer igtlMessage, std::vector<igtl::MessageBase::Pointer>& igtlMessages);
107 
108 private:
110  void operator=(const vtkPlusIgtlMessageFactory&);
111 
112 };
113 
114 #endif
igsioStatus PlusStatus
Definition: PlusCommon.h:40
#define VTK_OVERRIDE
Definition: PlusCommon.h:49
igtl::MessageFactory::Pointer IgtlFactory
Factory class of supported OpenIGTLink message types.
igtl::MessageBase::Pointer(* PointerToMessageBaseNew)()
This class provides client information for vtkPlusOpenIGTLinkServer.