PlusLib
2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
|
This class provides a network interface to access Plus functions as an OpenIGTLink client. More...
#include <src/PlusServer/vtkPlusOpenIGTLinkClient.h>
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 vtkPlusOpenIGTLinkClient * | New () |
static vtkPlusOpenIGTLinkClient * | SafeDownCast (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< vtkPlusIgtlMessageFactory > | IgtlMessageFactory |
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 |
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.
typedef vtkObject vtkPlusOpenIGTLinkClient::Superclass |
Definition at line 44 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Protected constructor.
Definition at line 26 of file vtkPlusOpenIGTLinkClient.cxx.
|
protectedvirtual |
Definition at line 43 of file vtkPlusOpenIGTLinkClient.cxx.
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.
|
staticprotected |
Thread for receiving control data from clients
Definition at line 311 of file vtkPlusOpenIGTLinkClient.cxx.
PlusStatus vtkPlusOpenIGTLinkClient::Disconnect | ( | ) |
Disconnect from the connected server
Definition at line 83 of file vtkPlusOpenIGTLinkClient.cxx.
|
virtual |
|
virtual |
|
static |
void vtkPlusOpenIGTLinkClient::Lock | ( | ) |
|
static |
|
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.
|
virtual |
Definition at line 305 of file vtkPlusOpenIGTLinkClient.cxx.
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.
|
static |
PlusStatus vtkPlusOpenIGTLinkClient::SendCommand | ( | vtkPlusCommand * | command | ) |
Send a command to the connected server
Definition at line 106 of file vtkPlusOpenIGTLinkClient.cxx.
PlusStatus vtkPlusOpenIGTLinkClient::SendMessage | ( | igtl::MessageBase::Pointer | packedMessage | ) |
Send a packed message to the connected server
Definition at line 190 of file vtkPlusOpenIGTLinkClient.cxx.
|
virtual |
|
virtual |
|
protected |
Thread-safe method that allows child classes to read data from the socket
Definition at line 422 of file vtkPlusOpenIGTLinkClient.cxx.
void vtkPlusOpenIGTLinkClient::Unlock | ( | ) |
vtkPlusOpenIGTLinkClient::vtkGetMacroConst | ( | ServerPort | , |
int | |||
) |
vtkPlusOpenIGTLinkClient::vtkGetMacroConst | ( | ServerIGTLVersion | , |
int | |||
) |
vtkPlusOpenIGTLinkClient::vtkGetStdStringMacro | ( | ServerHost | ) |
vtkPlusOpenIGTLinkClient::vtkSetStdStringMacro | ( | ServerHost | ) |
|
staticprotected |
Definition at line 130 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 118 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 107 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 109 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
igtl Factory for message sending
Definition at line 105 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 120 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Mutex instance for safe data access
Definition at line 115 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 122 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 125 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 128 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 124 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
Definition at line 116 of file vtkPlusOpenIGTLinkClient.h.
|
protected |
vtkMultiThreader instance for controlling threads
Definition at line 112 of file vtkPlusOpenIGTLinkClient.h.