15 #include "igtlMessageBase.h" 41 std::stringstream infolog;
43 infolog <<
"Received message of type ";
45 if (dynamic_cast<igtl::TrackingDataMessage*>(msg.GetPointer()) !=
nullptr)
50 this->
m_TrackingDataQueue.push_back(dynamic_cast<igtl::TrackingDataMessage*>(msg.GetPointer()));
54 else if (dynamic_cast<igtl::TransformMessage*>(msg.GetPointer()) !=
nullptr)
59 this->
m_TransformQueue.push_back(dynamic_cast<igtl::TransformMessage*>(msg.GetPointer()));
61 infolog <<
"TRANSFORM";
63 else if (dynamic_cast<igtl::StringMessage*>(msg.GetPointer()) !=
nullptr)
68 this->
m_StringQueue.push_back(dynamic_cast<igtl::StringMessage*>(msg.GetPointer()));
72 else if (dynamic_cast<igtl::ImageMessage*>(msg.GetPointer()) !=
nullptr)
74 igtl::ImageMessage::Pointer imageMsg =
dynamic_cast<igtl::ImageMessage*
>(msg.GetPointer());
75 int* dim =
new int[3];
76 imageMsg->GetDimensions(dim);
82 this->
m_Image3dQueue.push_back(dynamic_cast<igtl::ImageMessage*>(msg.GetPointer()));
91 this->
m_Image2dQueue.push_back(dynamic_cast<igtl::ImageMessage*>(msg.GetPointer()));
115 mitk::IGTLMessage::Pointer ret =
nullptr;
128 igtl::MessageBase::Pointer ret =
nullptr;
141 igtl::ImageMessage::Pointer ret =
nullptr;
154 igtl::ImageMessage::Pointer ret =
nullptr;
167 igtl::TrackingDataMessage::Pointer ret =
nullptr;
180 igtl::MessageBase::Pointer ret =
nullptr;
193 igtl::StringMessage::Pointer ret =
nullptr;
206 igtl::TransformMessage::Pointer ret =
nullptr;
223 s <<
"Device Type: " << this->
m_Latest_Message->GetDeviceType() << std::endl;
224 s <<
"Device Name: " << this->
m_Latest_Message->GetDeviceName() << std::endl;
256 s <<
"Device Type: " << this->
m_Latest_Message->GetDeviceType() << std::endl;
257 s <<
"Device Name: " << this->
m_Latest_Message->GetDeviceName() << std::endl;
301 this->
m_Mutex = itk::FastMutexLock::New();
itk::FastMutexLock::Pointer m_Mutex
Mutex to take car of the queue.
igtl::ImageMessage::Pointer PullImage2dMessage()
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
std::deque< igtl::StringMessage::Pointer > m_StringQueue
void PushCommandMessage(igtl::MessageBase::Pointer message)
Adds the message to the queue.
void PushMessage(igtl::MessageBase::Pointer message)
Adds the message to the queue.
void PushSendMessage(mitk::IGTLMessage::Pointer message)
std::deque< igtl::TransformMessage::Pointer > m_TransformQueue
igtl::StringMessage::Pointer PullStringMessage()
std::deque< mitk::IGTLMessage::Pointer > m_SendQueue
~IGTLMessageQueue() override
igtl::MessageBase::Pointer m_Latest_Message
std::string GetNextMsgInformationString()
Returns a string with information about the oldest message in the queue.
igtl::TransformMessage::Pointer PullTransformMessage()
igtl::MessageBase::Pointer PullCommandMessage()
std::string GetLatestMsgInformationString()
Returns a string with information about the oldest message in the queue.
std::string GetLatestMsgDeviceType()
Returns the device type of the oldest message in the queue.
igtl::TrackingDataMessage::Pointer PullTrackingMessage()
igtl::ImageMessage::Pointer PullImage3dMessage()
std::deque< igtl::ImageMessage::Pointer > m_Image2dQueue
std::string GetNextMsgDeviceType()
Returns the device type of the oldest message in the queue.
int GetSize()
Get the number of messages in the queue.
mitk::IGTLMessage::Pointer PullSendMessage()
void EnableNoBufferingMode(bool enable)
std::deque< igtl::TrackingDataMessage::Pointer > m_TrackingDataQueue
igtl::MessageBase::Pointer PullMiscMessage()
Returns and removes the oldest message from the queue.