PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusIGTLMessageQueue.cxx
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 // Local includes
8 #include "PlusConfigure.h"
10 
11 // IGSIO includes
12 #include "vtkIGSIORecursiveCriticalSection.h"
13 
14 // VTK includes
15 #include <vtkObjectFactory.h>
16 #include <vtksys/SystemTools.hxx>
17 
18 // STL includes
19 #include <string>
20 
21 // IGT includes
22 #include <igtlMessageBase.h>
23 
24 //----------------------------------------------------------------------------
25 
27 
28 //----------------------------------------------------------------------------
29 void vtkPlusIGTLMessageQueue::PrintSelf(ostream& os, vtkIndent indent)
30 {
31 
32 }
33 
34 //----------------------------------------------------------------------------
36 {
37  this->Mutex->Lock();
38  this->DataBuffer.push_back(message);
39  this->Mutex->Unlock();
40 }
41 
42 //----------------------------------------------------------------------------
44 {
45  this->Mutex->Lock();
46  igtl::MessageBase* ret = NULL;
47  if (this->DataBuffer.size() > 0)
48  {
49  ret = this->DataBuffer.front();
50  this->DataBuffer.pop_front();
51  }
52  this->Mutex->Unlock();
53 
54  return ret;
55 }
56 
57 //----------------------------------------------------------------------------
59 {
60  return this->DataBuffer.size();
61 }
62 
63 //----------------------------------------------------------------------------
65 {
66  this->Mutex = vtkIGSIORecursiveCriticalSection::New();
67 }
68 
69 //----------------------------------------------------------------------------
71 {
72  this->Mutex->Delete();
73 }
vtkIGSIORecursiveCriticalSection * Mutex
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
void PushMessage(igtl::MessageBase *message)
Message queue to store OpenIGTLink messages.
vtkStandardNewMacro(vtkPlusIGTLMessageQueue)
igtl::MessageBase * PullMessage()
const char * message
Definition: phidget22.h:2457