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
vtkPlusCommandProcessor Class Reference

Creates a PlusCommand from a string. If the commands are to be executed on the main thread then call ExecuteCommands() periodically from the main thread. If the commands are to be executed on a separate thread (to allow background processing, but maybe requiring more synchronization) call Start() to start an internal processing thread. Probably one of the processing models would be enough, but at this point it's not clear which one is better. TODO: keep only one method and remove the other approach completely once the processing model decision is finalized. More...

#include <src/PlusServer/vtkPlusCommandProcessor.h>

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

Public Types

typedef vtkObject Superclass
 

Public Member Functions

int ExecuteCommands ()
 
virtual const char * GetClassName ()
 
virtual vtkPlusOpenIGTLinkServerGetPlusServer ()
 
virtual int IsA (const char *type)
 
virtual bool IsRunning ()
 
virtual void PopCommandResponses (PlusCommandResponseList &responses)
 
virtual void PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE
 
virtual PlusStatus QueueCommand (bool respondUsingIGTLCommand, unsigned int clientId, const std::string &commandName, const std::string &commandString, const std::string &deviceName, uint32_t uid, const igtl::MessageBase::MetaDataMap &metaData)
 
virtual PlusStatus QueueCommandResponse (PlusStatus status, const std::string &deviceName, unsigned int clientId, const std::string &commandName, uint32_t uid, const std::string &replyString, const std::string &errorString)
 
PlusStatus QueueGetImage (unsigned int clientId, const std::string &deviceName)
 
PlusStatus QueueGetImageMetaData (unsigned int clientId, const std::string &deviceName)
 
virtual PlusStatus QueueStringResponse (PlusStatus status, const std::string &deviceName, unsigned int clientId, const std::string &replyString)
 
virtual PlusStatus RegisterPlusCommand (vtkPlusCommand *cmd)
 
virtual void SetPlusServer (vtkPlusOpenIGTLinkServer *)
 
virtual PlusStatus Start ()
 
virtual PlusStatus Stop ()
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkPlusCommandProcessorNew ()
 
static vtkPlusCommandProcessorSafeDownCast (vtkObject *o)
 

Protected Member Functions

vtkPlusCommandCreatePlusCommand (const std::string &commandName, const std::string &commandStr, const igtl::MessageBase::MetaDataMap &metaData)
 
 vtkPlusCommandProcessor ()
 
virtual ~vtkPlusCommandProcessor ()
 

Static Protected Member Functions

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

Detailed Description

Creates a PlusCommand from a string. If the commands are to be executed on the main thread then call ExecuteCommands() periodically from the main thread. If the commands are to be executed on a separate thread (to allow background processing, but maybe requiring more synchronization) call Start() to start an internal processing thread. Probably one of the processing models would be enough, but at this point it's not clear which one is better. TODO: keep only one method and remove the other approach completely once the processing model decision is finalized.

Definition at line 31 of file vtkPlusCommandProcessor.h.

Member Typedef Documentation

◆ Superclass

Definition at line 35 of file vtkPlusCommandProcessor.h.

Constructor & Destructor Documentation

◆ vtkPlusCommandProcessor()

vtkPlusCommandProcessor::vtkPlusCommandProcessor ( )
protected

Definition at line 65 of file vtkPlusCommandProcessor.cxx.

◆ ~vtkPlusCommandProcessor()

vtkPlusCommandProcessor::~vtkPlusCommandProcessor ( )
protectedvirtual

Definition at line 112 of file vtkPlusCommandProcessor.cxx.

Member Function Documentation

◆ CommandExecutionThread()

void * vtkPlusCommandProcessor::CommandExecutionThread ( vtkMultiThreader::ThreadInfo *  data)
staticprotected

Thread for client connection handling

Definition at line 165 of file vtkPlusCommandProcessor.cxx.

◆ CreatePlusCommand()

vtkPlusCommand * vtkPlusCommandProcessor::CreatePlusCommand ( const std::string &  commandName,
const std::string &  commandStr,
const igtl::MessageBase::MetaDataMap &  metaData 
)
protected

Definition at line 253 of file vtkPlusCommandProcessor.cxx.

◆ ExecuteCommands()

int vtkPlusCommandProcessor::ExecuteCommands ( )

Execute all commands in the queue from the current thread (useful if commands should be executed from the main thread)

Returns
Number of executed commands

Definition at line 191 of file vtkPlusCommandProcessor.cxx.

◆ GetClassName()

virtual const char* vtkPlusCommandProcessor::GetClassName ( )
virtual

◆ GetPlusServer()

virtual vtkPlusOpenIGTLinkServer* vtkPlusCommandProcessor::GetPlusServer ( )
virtual

◆ IsA()

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

◆ IsRunning()

bool vtkPlusCommandProcessor::IsRunning ( )
virtual

Returns true if the command processing thread is running. Can be called from any thread.

Definition at line 417 of file vtkPlusCommandProcessor.cxx.

◆ IsTypeOf()

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

◆ New()

static vtkPlusCommandProcessor* vtkPlusCommandProcessor::New ( )
static

◆ PopCommandResponses()

void vtkPlusCommandProcessor::PopCommandResponses ( PlusCommandResponseList responses)
virtual

Return the queued command responses and removes the items from the queue (so that each item is returned only once) and clears the response queue. The caller is responsible for deleting the returned response objects. Can be called from any thread.

Definition at line 407 of file vtkPlusCommandProcessor.cxx.

◆ PrintSelf()

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

Definition at line 123 of file vtkPlusCommandProcessor.cxx.

◆ QueueCommand()

PlusStatus vtkPlusCommandProcessor::QueueCommand ( bool  respondUsingIGTLCommand,
unsigned int  clientId,
const std::string &  commandName,
const std::string &  commandString,
const std::string &  deviceName,
uint32_t  uid,
const igtl::MessageBase::MetaDataMap &  metaData 
)
virtual

Adds a command to the queue for execution. Can be called from any thread.

Definition at line 288 of file vtkPlusCommandProcessor.cxx.

◆ QueueCommandResponse()

PlusStatus vtkPlusCommandProcessor::QueueCommandResponse ( PlusStatus  status,
const std::string &  deviceName,
unsigned int  clientId,
const std::string &  commandName,
uint32_t  uid,
const std::string &  replyString,
const std::string &  errorString 
)
virtual

Adds a response to the response queue for reply. Can be called from any thread. Adds support for receiving commands to be rejected without processing but send an error reply

Definition at line 355 of file vtkPlusCommandProcessor.cxx.

◆ QueueGetImage()

PlusStatus vtkPlusCommandProcessor::QueueGetImage ( unsigned int  clientId,
const std::string &  deviceName 
)

Adds a command to the queue for execution of the vtkGetImageCommand with the name GET_IMAGE !

Definition at line 390 of file vtkPlusCommandProcessor.cxx.

◆ QueueGetImageMetaData()

PlusStatus vtkPlusCommandProcessor::QueueGetImageMetaData ( unsigned int  clientId,
const std::string &  deviceName 
)

Adds a command to the queue for execution of the vtkGetImageCommand with the name GET_IMGMETA !

Definition at line 373 of file vtkPlusCommandProcessor.cxx.

◆ QueueStringResponse()

PlusStatus vtkPlusCommandProcessor::QueueStringResponse ( PlusStatus  status,
const std::string &  deviceName,
unsigned int  clientId,
const std::string &  replyString 
)
virtual

Adds a response to the response queue for reply. Can be called from any thread. Adds support for receiving commands to be rejected without processing but send an error reply

Definition at line 330 of file vtkPlusCommandProcessor.cxx.

◆ RegisterPlusCommand()

PlusStatus vtkPlusCommandProcessor::RegisterPlusCommand ( vtkPlusCommand cmd)
virtual

Register custom command. Must be called from the main thread.

Parameters
cmdIt should point to a valid vtkPlusCommand instance. The caller can delete the cmd object after the call.

Definition at line 228 of file vtkPlusCommandProcessor.cxx.

◆ SafeDownCast()

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

◆ SetPlusServer()

virtual void vtkPlusCommandProcessor::SetPlusServer ( vtkPlusOpenIGTLinkServer )
virtual

◆ Start()

PlusStatus vtkPlusCommandProcessor::Start ( )
virtual

Start thread for processing the commands in the queue. Must be called from the main thread.

Definition at line 134 of file vtkPlusCommandProcessor.cxx.

◆ Stop()

PlusStatus vtkPlusCommandProcessor::Stop ( )
virtual

Stop command processing. Must be called from the main thread.

Definition at line 145 of file vtkPlusCommandProcessor.cxx.


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