Medical Imaging Interaction Toolkit  2016.11.0
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,
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 IGTLMessageQueue_H
18 #define IGTLMessageQueue_H
19 
20 #include "MitkOpenIGTLinkExports.h"
21 
22 #include "itkObject.h"
23 #include "itkFastMutexLock.h"
24 #include "mitkCommon.h"
25 
26 #include <deque>
27 
28 //OpenIGTLink
29 #include "igtlMessageBase.h"
30 #include "igtlImageMessage.h"
31 #include "igtlStringMessage.h"
32 #include "igtlTrackingDataMessage.h"
33 #include "igtlTransformMessage.h"
34 
35 namespace mitk {
42  class MITKOPENIGTLINK_EXPORT IGTLMessageQueue : public itk::Object
43  {
44  public:
46  itkFactorylessNewMacro(Self)
47  itkCloneMacro(Self)
48 
49 
54  enum BufferingType { Infinit, NoBuffering };
55 
56  void PushSendMessage(igtl::MessageBase::Pointer message);
57 
61  void PushMessage(igtl::MessageBase::Pointer message);
62 
66  void PushCommandMessage(igtl::MessageBase::Pointer message);
70  igtl::MessageBase::Pointer PullMiscMessage();
71  igtl::ImageMessage::Pointer PullImage2dMessage();
72  igtl::ImageMessage::Pointer PullImage3dMessage();
73  igtl::TrackingDataMessage::Pointer PullTrackingMessage();
74  igtl::MessageBase::Pointer PullCommandMessage();
75  igtl::StringMessage::Pointer PullStringMessage();
76  igtl::TransformMessage::Pointer PullTransformMessage();
77  igtl::MessageBase::Pointer PullSendMessage();
78 
82  int GetSize();
83 
88  std::string GetNextMsgInformationString();
89 
93  std::string GetNextMsgDeviceType();
94 
99  std::string GetLatestMsgInformationString();
100 
104  std::string GetLatestMsgDeviceType();
105 
110  void EnableInfiniteBuffering(bool enable);
111 
112  protected:
114  virtual ~IGTLMessageQueue();
115 
116  protected:
121 
125  std::deque< igtl::MessageBase::Pointer > m_CommandQueue;
126  std::deque< igtl::ImageMessage::Pointer > m_Image2dQueue;
127  std::deque< igtl::ImageMessage::Pointer > m_Image3dQueue;
128  std::deque< igtl::TransformMessage::Pointer > m_TransformQueue;
129  std::deque< igtl::TrackingDataMessage::Pointer > m_TrackingDataQueue;
130  std::deque< igtl::StringMessage::Pointer > m_StringQueue;
131  std::deque< igtl::MessageBase::Pointer > m_MiscQueue;
132 
133  std::deque< igtl::MessageBase::Pointer> m_SendQueue;
134 
136 
141  };
142 }
143 
144 #endif
itk::SmartPointer< Self > Pointer
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.
std::deque< igtl::StringMessage::Pointer > m_StringQueue
Thread safe message queue to store OpenIGTLink messages.
std::deque< igtl::TransformMessage::Pointer > m_TransformQueue
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:53
std::deque< igtl::MessageBase::Pointer > m_SendQueue
std::deque< igtl::ImageMessage::Pointer > m_Image2dQueue
std::deque< igtl::TrackingDataMessage::Pointer > m_TrackingDataQueue