PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
vtkPlusOpenIGTLinkClient Class Reference

This class provides a network interface to access Plus functions as an OpenIGTLink client. More...

#include <src/PlusServer/vtkPlusOpenIGTLinkClient.h>

Inheritance diagram for vtkPlusOpenIGTLinkClient:
Inheritance graph
[legend]
Collaboration diagram for vtkPlusOpenIGTLinkClient:
Collaboration graph
[legend]

Public Types

typedef vtkObject Superclass
 

Public Member Functions

PlusStatus Connect (double timeoutSec=-1)
 
PlusStatus Disconnect ()
 
virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void Lock ()
 
virtual bool OnMessageReceived (igtl::MessageHeader::Pointer messageHeader)
 
virtual void PrintSelf (ostream &os, vtkIndent indent)
 
PlusStatus ReceiveReply (PlusStatus &result, int32_t &outOriginalCommandId, std::string &outErrorString, std::string &outContent, igtl::MessageBase::MetaDataMap &outParameters, std::string &outCommandName, double timeoutSec=0)
 
PlusStatus SendCommand (vtkPlusCommand *command)
 
PlusStatus SendMessage (igtl::MessageBase::Pointer packedMessage)
 
virtual void SetServerIGTLVersion (int)
 
virtual void SetServerPort (int)
 
void Unlock ()
 
 vtkGetMacroConst (ServerPort, int)
 
 vtkGetMacroConst (ServerIGTLVersion, int)
 
 vtkGetStdStringMacro (ServerHost)
 
 vtkSetStdStringMacro (ServerHost)
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkPlusOpenIGTLinkClientNew ()
 
static vtkPlusOpenIGTLinkClientSafeDownCast (vtkObject *o)
 

Protected Member Functions

igtlUint64 SocketReceive (void *data, igtlUint64 length)
 
 vtkPlusOpenIGTLinkClient ()
 
virtual ~vtkPlusOpenIGTLinkClient ()
 

Static Protected Member Functions

static void * DataReceiverThread (vtkMultiThreader::ThreadInfo *data)
 

Protected Attributes

igtl::ClientSocket::Pointer ClientSocket
 
std::pair< bool, bool > DataReceiverActive
 
int DataReceiverThreadId
 
vtkSmartPointer< vtkPlusIgtlMessageFactoryIgtlMessageFactory
 
igtlUint32 LastGeneratedCommandId
 
vtkSmartPointer< vtkIGSIORecursiveCriticalSection > Mutex
 
std::deque< igtl::MessageBase::Pointer > Replies
 
std::string ServerHost
 
int ServerIGTLVersion
 
int ServerPort
 
vtkSmartPointer< vtkIGSIORecursiveCriticalSection > SocketMutex
 
vtkSmartPointer< vtkMultiThreader > Threader
 

Static Protected Attributes

static const float CLIENT_SOCKET_TIMEOUT_SEC = 0.5
 

Detailed Description

This class provides a network interface to access Plus functions as an OpenIGTLink client.

It connects to a Plus server, sends requests and receives responses.

Definition at line 40 of file vtkPlusOpenIGTLinkClient.h.

Member Typedef Documentation

◆ Superclass

Definition at line 44 of file vtkPlusOpenIGTLinkClient.h.

Constructor & Destructor Documentation

◆ vtkPlusOpenIGTLinkClient()

vtkPlusOpenIGTLinkClient::vtkPlusOpenIGTLinkClient ( )
protected

Protected constructor.

Definition at line 26 of file vtkPlusOpenIGTLinkClient.cxx.

◆ ~vtkPlusOpenIGTLinkClient()

vtkPlusOpenIGTLinkClient::~vtkPlusOpenIGTLinkClient ( )
protectedvirtual

Definition at line 43 of file vtkPlusOpenIGTLinkClient.cxx.

Member Function Documentation

◆ Connect()

PlusStatus vtkPlusOpenIGTLinkClient::Connect ( double  timeoutSec = -1)

If timeoutSec<0 then connection will be attempted multiple times until successfully connected or the timeout elapse

Definition at line 48 of file vtkPlusOpenIGTLinkClient.cxx.

◆ DataReceiverThread()

void * vtkPlusOpenIGTLinkClient::DataReceiverThread ( vtkMultiThreader::ThreadInfo *  data)
staticprotected

Thread for receiving control data from clients

Definition at line 311 of file vtkPlusOpenIGTLinkClient.cxx.

◆ Disconnect()

PlusStatus vtkPlusOpenIGTLinkClient::Disconnect ( )

Disconnect from the connected server

Definition at line 83 of file vtkPlusOpenIGTLinkClient.cxx.

◆ GetClassName()

virtual const char* vtkPlusOpenIGTLinkClient::GetClassName ( )
virtual

◆ IsA()

virtual int vtkPlusOpenIGTLinkClient::IsA ( const char *  type)
virtual

◆ IsTypeOf()

static int vtkPlusOpenIGTLinkClient::IsTypeOf ( const char *  type)
static

◆ Lock()

void vtkPlusOpenIGTLinkClient::Lock ( )

◆ New()

static vtkPlusOpenIGTLinkClient* vtkPlusOpenIGTLinkClient::New ( )
static

◆ OnMessageReceived()

virtual bool vtkPlusOpenIGTLinkClient::OnMessageReceived ( igtl::MessageHeader::Pointer  messageHeader)
inlinevirtual

This method can be overridden in child classes to process received messages. Note that this method is executed from the data receiver thread and not the main thread. If the message body is read then this method should return true. If the message is not read then this method should return false (and the message body will be skipped).

Definition at line 88 of file vtkPlusOpenIGTLinkClient.h.

◆ PrintSelf()

void vtkPlusOpenIGTLinkClient::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
virtual

Definition at line 305 of file vtkPlusOpenIGTLinkClient.cxx.

◆ ReceiveReply()

PlusStatus vtkPlusOpenIGTLinkClient::ReceiveReply ( PlusStatus result,
int32_t &  outOriginalCommandId,
std::string &  outErrorString,
std::string &  outContent,
igtl::MessageBase::MetaDataMap &  outParameters,
std::string &  outCommandName,
double  timeoutSec = 0 
)

Wait for a command reply

Definition at line 206 of file vtkPlusOpenIGTLinkClient.cxx.

◆ SafeDownCast()

static vtkPlusOpenIGTLinkClient* vtkPlusOpenIGTLinkClient::SafeDownCast ( vtkObject *  o)
static

◆ SendCommand()

PlusStatus vtkPlusOpenIGTLinkClient::SendCommand ( vtkPlusCommand command)

Send a command to the connected server

Definition at line 106 of file vtkPlusOpenIGTLinkClient.cxx.

◆ SendMessage()

PlusStatus vtkPlusOpenIGTLinkClient::SendMessage ( igtl::MessageBase::Pointer  packedMessage)

Send a packed message to the connected server

Definition at line 190 of file vtkPlusOpenIGTLinkClient.cxx.

◆ SetServerIGTLVersion()

virtual void vtkPlusOpenIGTLinkClient::SetServerIGTLVersion ( int  )
virtual

◆ SetServerPort()

virtual void vtkPlusOpenIGTLinkClient::SetServerPort ( int  )
virtual

◆ SocketReceive()

igtlUint64 vtkPlusOpenIGTLinkClient::SocketReceive ( void *  data,
igtlUint64  length 
)
protected

Thread-safe method that allows child classes to read data from the socket

Definition at line 422 of file vtkPlusOpenIGTLinkClient.cxx.

◆ Unlock()

void vtkPlusOpenIGTLinkClient::Unlock ( )

◆ vtkGetMacroConst() [1/2]

vtkPlusOpenIGTLinkClient::vtkGetMacroConst ( ServerPort  ,
int   
)

◆ vtkGetMacroConst() [2/2]

vtkPlusOpenIGTLinkClient::vtkGetMacroConst ( ServerIGTLVersion  ,
int   
)

◆ vtkGetStdStringMacro()

vtkPlusOpenIGTLinkClient::vtkGetStdStringMacro ( ServerHost  )

◆ vtkSetStdStringMacro()

vtkPlusOpenIGTLinkClient::vtkSetStdStringMacro ( ServerHost  )

Member Data Documentation

◆ CLIENT_SOCKET_TIMEOUT_SEC

const float vtkPlusOpenIGTLinkClient::CLIENT_SOCKET_TIMEOUT_SEC = 0.5
staticprotected

Definition at line 130 of file vtkPlusOpenIGTLinkClient.h.

◆ ClientSocket

igtl::ClientSocket::Pointer vtkPlusOpenIGTLinkClient::ClientSocket
protected

Definition at line 118 of file vtkPlusOpenIGTLinkClient.h.

◆ DataReceiverActive

std::pair<bool, bool> vtkPlusOpenIGTLinkClient::DataReceiverActive
protected

Definition at line 107 of file vtkPlusOpenIGTLinkClient.h.

◆ DataReceiverThreadId

int vtkPlusOpenIGTLinkClient::DataReceiverThreadId
protected

Definition at line 109 of file vtkPlusOpenIGTLinkClient.h.

◆ IgtlMessageFactory

vtkSmartPointer<vtkPlusIgtlMessageFactory> vtkPlusOpenIGTLinkClient::IgtlMessageFactory
protected

igtl Factory for message sending

Definition at line 105 of file vtkPlusOpenIGTLinkClient.h.

◆ LastGeneratedCommandId

igtlUint32 vtkPlusOpenIGTLinkClient::LastGeneratedCommandId
protected

Definition at line 120 of file vtkPlusOpenIGTLinkClient.h.

◆ Mutex

vtkSmartPointer<vtkIGSIORecursiveCriticalSection> vtkPlusOpenIGTLinkClient::Mutex
protected

Mutex instance for safe data access

Definition at line 115 of file vtkPlusOpenIGTLinkClient.h.

◆ Replies

std::deque<igtl::MessageBase::Pointer> vtkPlusOpenIGTLinkClient::Replies
protected

Definition at line 122 of file vtkPlusOpenIGTLinkClient.h.

◆ ServerHost

std::string vtkPlusOpenIGTLinkClient::ServerHost
protected

Definition at line 125 of file vtkPlusOpenIGTLinkClient.h.

◆ ServerIGTLVersion

int vtkPlusOpenIGTLinkClient::ServerIGTLVersion
protected

Definition at line 128 of file vtkPlusOpenIGTLinkClient.h.

◆ ServerPort

int vtkPlusOpenIGTLinkClient::ServerPort
protected

Definition at line 124 of file vtkPlusOpenIGTLinkClient.h.

◆ SocketMutex

vtkSmartPointer<vtkIGSIORecursiveCriticalSection> vtkPlusOpenIGTLinkClient::SocketMutex
protected

Definition at line 116 of file vtkPlusOpenIGTLinkClient.h.

◆ Threader

vtkSmartPointer<vtkMultiThreader> vtkPlusOpenIGTLinkClient::Threader
protected

vtkMultiThreader instance for controlling threads

Definition at line 112 of file vtkPlusOpenIGTLinkClient.h.


The documentation for this class was generated from the following files: