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>
|
int | ExecuteCommands () |
|
virtual const char * | GetClassName () |
|
virtual vtkPlusOpenIGTLinkServer * | GetPlusServer () |
|
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 () |
|
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.
◆ Superclass
◆ vtkPlusCommandProcessor()
vtkPlusCommandProcessor::vtkPlusCommandProcessor |
( |
| ) |
|
|
protected |
◆ ~vtkPlusCommandProcessor()
vtkPlusCommandProcessor::~vtkPlusCommandProcessor |
( |
| ) |
|
|
protectedvirtual |
◆ CommandExecutionThread()
void * vtkPlusCommandProcessor::CommandExecutionThread |
( |
vtkMultiThreader::ThreadInfo * |
data | ) |
|
|
staticprotected |
◆ CreatePlusCommand()
vtkPlusCommand * vtkPlusCommandProcessor::CreatePlusCommand |
( |
const std::string & |
commandName, |
|
|
const std::string & |
commandStr, |
|
|
const igtl::MessageBase::MetaDataMap & |
metaData |
|
) |
| |
|
protected |
◆ 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()
◆ IsA()
virtual int vtkPlusCommandProcessor::IsA |
( |
const char * |
type | ) |
|
|
virtual |
◆ IsRunning()
bool vtkPlusCommandProcessor::IsRunning |
( |
| ) |
|
|
virtual |
◆ IsTypeOf()
static int vtkPlusCommandProcessor::IsTypeOf |
( |
const char * |
type | ) |
|
|
static |
◆ New()
◆ PopCommandResponses()
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 |
◆ 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 |
◆ 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()
Register custom command. Must be called from the main thread.
- Parameters
-
cmd | It 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()
◆ SetPlusServer()
◆ Start()
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()
The documentation for this class was generated from the following files: