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

This is an abstract superclass for commands in the OpenIGTLink network interface for Plus. More...

#include <src/PlusServer/Commands/vtkPlusCommand.h>

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

Public Member Functions

virtual vtkPlusCommandClone ()=0
 
virtual PlusStatus Execute ()=0
 
virtual int GetClientId ()
 
virtual void GetCommandNames (std::list< std::string > &cmdNames)=0
 
virtual std::string GetDescription (const std::string &commandName)=0
 
virtual uint32_t GetId ()
 
virtual bool GetRespondWithCommandMessage ()
 
void PopCommandResponses (PlusCommandResponseList &responses)
 
virtual void PrintSelf (ostream &os, vtkIndent indent)
 
virtual PlusStatus ReadConfiguration (vtkXMLDataElement *aConfig)
 
virtual void SetClientId (int)
 
virtual void SetCommandProcessor (vtkPlusCommandProcessor *processor)
 
virtual void SetId (uint32_t)
 
void SetMetaData (const igtl::MessageBase::MetaDataMap &metaData)
 
virtual void SetRespondWithCommandMessage (bool)
 
 vtkGetStdStringMacro (Name)
 
 vtkGetStdStringMacro (DeviceName)
 
 vtkSetStdStringMacro (Name)
 
 vtkSetStdStringMacro (DeviceName)
 
virtual PlusStatus WriteConfiguration (vtkXMLDataElement *aConfig)
 

Static Public Member Functions

static PlusStatus GenerateCommandDeviceName (const std::string &uid, std::string &outDeviceName)
 
static std::string GenerateReplyDeviceName (uint32_t uid)
 
static std::string GetPrefixFromCommandDeviceName (const std::string &deviceName)
 
static std::string GetUidFromCommandDeviceName (const std::string &deviceName)
 
static bool IsCommandDeviceName (const std::string &deviceName)
 
static bool IsReplyDeviceName (const std::string &deviceName, const std::string &uid=std::string(""))
 

Static Public Attributes

static const std::string DEVICE_NAME_COMMAND = "CMD"
 
static const std::string DEVICE_NAME_REPLY = "ACK"
 

Protected Member Functions

virtual vtkPlusDataCollectorGetDataCollector ()
 
virtual vtkIGSIOTransformRepository * GetTransformRepository ()
 
void QueueCommandResponse (PlusStatus status, const std::string &message, const std::string &error="", const igtl::MessageBase::MetaDataMap *metaData=nullptr)
 
PlusStatus ValidateName ()
 
 vtkPlusCommand ()
 
virtual ~vtkPlusCommand ()
 

Protected Attributes

int ClientId
 
vtkPlusCommandProcessorCommandProcessor
 
PlusCommandResponseList CommandResponseQueue
 
std::string DeviceName
 
uint32_t Id
 
igtl::MessageBase::MetaDataMap MetaData
 
std::string Name
 
bool RespondWithCommandMessage
 

Detailed Description

This is an abstract superclass for commands in the OpenIGTLink network interface for Plus.

All commands have a unique string representation to enable sending commands as string messages. For e.g. through OpenIGTLink.

Definition at line 31 of file vtkPlusCommand.h.

Constructor & Destructor Documentation

◆ vtkPlusCommand()

vtkPlusCommand::vtkPlusCommand ( )
protected

Definition at line 19 of file vtkPlusCommand.cxx.

◆ ~vtkPlusCommand()

vtkPlusCommand::~vtkPlusCommand ( )
protectedvirtual

Definition at line 28 of file vtkPlusCommand.cxx.

Member Function Documentation

◆ Clone()

virtual vtkPlusCommand* vtkPlusCommand::Clone ( )
pure virtual

◆ Execute()

virtual PlusStatus vtkPlusCommand::Execute ( )
pure virtual

◆ GenerateCommandDeviceName()

PlusStatus vtkPlusCommand::GenerateCommandDeviceName ( const std::string &  uid,
std::string &  outDeviceName 
)
static

LEGACY - for supporting receiving commands from OpenIGTLink v1/v2 clients

Generates a command device name from a specified unique identifier (UID). The device name is "CMD_uidvalue" (if the UID is empty then the funtion fails).

Definition at line 173 of file vtkPlusCommand.cxx.

◆ GenerateReplyDeviceName()

std::string vtkPlusCommand::GenerateReplyDeviceName ( uint32_t  uid)
static

LEGACY - for supporting receiving commands from OpenIGTLink v1/v2 clients

Generates a command reply device name from a specified unique identifier (UID). The device name is "ACK_uidvalue" (if the UID is empty then the device name is "ACK").

Definition at line 165 of file vtkPlusCommand.cxx.

◆ GetClientId()

virtual int vtkPlusCommand::GetClientId ( )
virtual

◆ GetCommandNames()

virtual void vtkPlusCommand::GetCommandNames ( std::list< std::string > &  cmdNames)
pure virtual

◆ GetDataCollector()

vtkPlusDataCollector * vtkPlusCommand::GetDataCollector ( )
protectedvirtual

Convenience function for getting a pointer to the data collector

Definition at line 93 of file vtkPlusCommand.cxx.

◆ GetDescription()

virtual std::string vtkPlusCommand::GetDescription ( const std::string &  commandName)
pure virtual

◆ GetId()

virtual uint32_t vtkPlusCommand::GetId ( )
virtual

◆ GetPrefixFromCommandDeviceName()

std::string vtkPlusCommand::GetPrefixFromCommandDeviceName ( const std::string &  deviceName)
static

Gets the prefix from a device name (e.g., device name is CMD_abc123, it returns CMD)

Definition at line 233 of file vtkPlusCommand.cxx.

◆ GetRespondWithCommandMessage()

virtual bool vtkPlusCommand::GetRespondWithCommandMessage ( )
virtual

◆ GetTransformRepository()

vtkIGSIOTransformRepository * vtkPlusCommand::GetTransformRepository ( )
protectedvirtual

Convenience function for getting a pointer to the transform repository

Definition at line 118 of file vtkPlusCommand.cxx.

◆ GetUidFromCommandDeviceName()

std::string vtkPlusCommand::GetUidFromCommandDeviceName ( const std::string &  deviceName)
static

Gets the uid from a device name (e.g., device name is CMD_abc123, it returns abc123)

Definition at line 221 of file vtkPlusCommand.cxx.

◆ IsCommandDeviceName()

bool vtkPlusCommand::IsCommandDeviceName ( const std::string &  deviceName)
static

LEGACY - for supporting receiving commands from OpenIGTLink v1/v2 clients

Checks if a deviceName is a command. For example: CMD_13

Definition at line 185 of file vtkPlusCommand.cxx.

◆ IsReplyDeviceName()

bool vtkPlusCommand::IsReplyDeviceName ( const std::string &  deviceName,
const std::string &  uid = std::string("") 
)
static

LEGACY - for supporting receiving commands from OpenIGTLink v1/v2 clients

Checks if a deviceName is a reply to a command. For example: ACK_13 is a reply to CMD_13

Definition at line 197 of file vtkPlusCommand.cxx.

◆ PopCommandResponses()

void vtkPlusCommand::PopCommandResponses ( PlusCommandResponseList responses)

Get command responses from the device, append them to the provided list, and then remove them from the command. The ownership of the command responses are transferred to the caller, it is responsible for deleting them.

Definition at line 245 of file vtkPlusCommand.cxx.

◆ PrintSelf()

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

◆ QueueCommandResponse()

void vtkPlusCommand::QueueCommandResponse ( PlusStatus  status,
const std::string &  message,
const std::string &  error = "",
const igtl::MessageBase::MetaDataMap *  metaData = nullptr 
)
protected

Helper method to add a command response to the response queue

Definition at line 253 of file vtkPlusCommand.cxx.

◆ ReadConfiguration()

PlusStatus vtkPlusCommand::ReadConfiguration ( vtkXMLDataElement *  aConfig)
virtual

◆ SetClientId()

virtual void vtkPlusCommand::SetClientId ( int  )
virtual

Set the id of the client that requested the command

◆ SetCommandProcessor()

void vtkPlusCommand::SetCommandProcessor ( vtkPlusCommandProcessor processor)
virtual

Set the command processor to get access to the data collection devices and other commands

Definition at line 81 of file vtkPlusCommand.cxx.

◆ SetId()

virtual void vtkPlusCommand::SetId ( uint32_t  )
virtual

◆ SetMetaData()

void vtkPlusCommand::SetMetaData ( const igtl::MessageBase::MetaDataMap &  metaData)

Definition at line 87 of file vtkPlusCommand.cxx.

◆ SetRespondWithCommandMessage()

virtual void vtkPlusCommand::SetRespondWithCommandMessage ( bool  )
virtual

◆ ValidateName()

PlusStatus vtkPlusCommand::ValidateName ( )
protected

Check if the command name is in the list of command names

Definition at line 143 of file vtkPlusCommand.cxx.

◆ vtkGetStdStringMacro() [1/2]

vtkPlusCommand::vtkGetStdStringMacro ( Name  )

◆ vtkGetStdStringMacro() [2/2]

vtkPlusCommand::vtkGetStdStringMacro ( DeviceName  )

◆ vtkSetStdStringMacro() [1/2]

vtkPlusCommand::vtkSetStdStringMacro ( Name  )

◆ vtkSetStdStringMacro() [2/2]

vtkPlusCommand::vtkSetStdStringMacro ( DeviceName  )

◆ WriteConfiguration()

PlusStatus vtkPlusCommand::WriteConfiguration ( vtkXMLDataElement *  aConfig)
virtual

Member Data Documentation

◆ ClientId

int vtkPlusCommand::ClientId
protected

Unique identifier of the Client that the response(s) will be sent to

Definition at line 150 of file vtkPlusCommand.h.

◆ CommandProcessor

vtkPlusCommandProcessor* vtkPlusCommand::CommandProcessor
protected

Definition at line 147 of file vtkPlusCommand.h.

◆ CommandResponseQueue

PlusCommandResponseList vtkPlusCommand::CommandResponseQueue
protected

Definition at line 173 of file vtkPlusCommand.h.

◆ DEVICE_NAME_COMMAND

const std::string vtkPlusCommand::DEVICE_NAME_COMMAND = "CMD"
static

Definition at line 34 of file vtkPlusCommand.h.

◆ DEVICE_NAME_REPLY

const std::string vtkPlusCommand::DEVICE_NAME_REPLY = "ACK"
static

Definition at line 35 of file vtkPlusCommand.h.

◆ DeviceName

std::string vtkPlusCommand::DeviceName
protected

Device name of the received command. Reply device name is DeviceNameReply by default.

Definition at line 153 of file vtkPlusCommand.h.

◆ Id

uint32_t vtkPlusCommand::Id
protected

Unique identifier of the command. It can be used to match commands and replies.

Definition at line 156 of file vtkPlusCommand.h.

◆ MetaData

igtl::MessageBase::MetaDataMap vtkPlusCommand::MetaData
protected

Meta data passed in from the igtl message

Definition at line 170 of file vtkPlusCommand.h.

◆ Name

std::string vtkPlusCommand::Name
protected

Name of the command. One command class may handle multiple commands, this Name member defines which of the supported command should be executed.

Definition at line 165 of file vtkPlusCommand.h.

◆ RespondWithCommandMessage

bool vtkPlusCommand::RespondWithCommandMessage
protected

Should we respond using igtl::StringMessage or igtl::CommandMessage

Definition at line 159 of file vtkPlusCommand.h.


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