Medical Imaging Interaction Toolkit  2018.4.99-6aa36ba9
Medical Imaging Interaction Toolkit
mitkIGTLMessageQueue.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 IGTLMessageQueue_H
14 #define IGTLMessageQueue_H
15 
16 #include "MitkOpenIGTLinkExports.h"
17 
18 #include "itkObject.h"
19 #include "itkFastMutexLock.h"
20 #include "mitkCommon.h"
21 
22 #include <deque>
23 #include <mitkIGTLMessage.h>
24 
25 //OpenIGTLink
26 #include "igtlMessageBase.h"
27 #include "igtlImageMessage.h"
28 #include "igtlStringMessage.h"
29 #include "igtlTrackingDataMessage.h"
30 #include "igtlTransformMessage.h"
31 
32 namespace mitk {
39  class MITKOPENIGTLINK_EXPORT IGTLMessageQueue : public itk::Object
40  {
41  public:
43  itkFactorylessNewMacro(Self)
44  itkCloneMacro(Self)
45 
46 
51  enum BufferingType { Infinit, NoBuffering };
52 
53  void PushSendMessage(mitk::IGTLMessage::Pointer message);
54 
58  void PushMessage(igtl::MessageBase::Pointer message);
59 
63  void PushCommandMessage(igtl::MessageBase::Pointer message);
67  igtl::MessageBase::Pointer PullMiscMessage();
68  igtl::ImageMessage::Pointer PullImage2dMessage();
69  igtl::ImageMessage::Pointer PullImage3dMessage();
70  igtl::TrackingDataMessage::Pointer PullTrackingMessage();
71  igtl::MessageBase::Pointer PullCommandMessage();
72  igtl::StringMessage::Pointer PullStringMessage();
73  igtl::TransformMessage::Pointer PullTransformMessage();
74  mitk::IGTLMessage::Pointer PullSendMessage();
75 
79  int GetSize();
80 
85  std::string GetNextMsgInformationString();
86 
90  std::string GetNextMsgDeviceType();
91 
96  std::string GetLatestMsgInformationString();
97 
101  std::string GetLatestMsgDeviceType();
102 
105  void EnableNoBufferingMode(bool enable);
106 
107  protected:
109  ~IGTLMessageQueue() override;
110 
111  protected:
115  itk::FastMutexLock::Pointer m_Mutex;
116 
120  std::deque< igtl::MessageBase::Pointer > m_CommandQueue;
121  std::deque< igtl::ImageMessage::Pointer > m_Image2dQueue;
122  std::deque< igtl::ImageMessage::Pointer > m_Image3dQueue;
123  std::deque< igtl::TransformMessage::Pointer > m_TransformQueue;
124  std::deque< igtl::TrackingDataMessage::Pointer > m_TrackingDataQueue;
125  std::deque< igtl::StringMessage::Pointer > m_StringQueue;
126  std::deque< igtl::MessageBase::Pointer > m_MiscQueue;
127 
128  std::deque< mitk::IGTLMessage::Pointer > m_SendQueue;
129 
130  igtl::MessageBase::Pointer m_Latest_Message;
131 
136  };
137 }
138 
139 #endif
itk::FastMutexLock::Pointer m_Mutex
Mutex to take car of the queue.
std::deque< igtl::MessageBase::Pointer > m_CommandQueue
the queue that stores pointer to the inserted messages
BufferingType m_BufferingType
defines the kind of buffering
std::deque< igtl::ImageMessage::Pointer > m_Image3dQueue
std::deque< igtl::MessageBase::Pointer > m_MiscQueue
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKOPENIGTLINK_EXPORT
std::deque< igtl::StringMessage::Pointer > m_StringQueue
Thread safe message queue to store OpenIGTLink messages.
std::deque< igtl::TransformMessage::Pointer > m_TransformQueue
std::deque< mitk::IGTLMessage::Pointer > m_SendQueue
igtl::MessageBase::Pointer m_Latest_Message
BufferingType
Different buffering types Infinit buffering means that you can push as many messages as you want NoBu...
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
std::deque< igtl::ImageMessage::Pointer > m_Image2dQueue
std::deque< igtl::TrackingDataMessage::Pointer > m_TrackingDataQueue