PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusCommand.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2  Program: Plus
3  Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4  See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef __VTKPLUSCOMMAND_H
8 #define __VTKPLUSCOMMAND_H
9 
10 #include "vtkPlusServerExport.h"
11 
14 //class vtkIGSIOTransformRepository;
15 class vtkImageData;
16 
17 #include "vtkPlusCommandResponse.h"
18 
19 // igtl includes
20 #include "igtlMessageBase.h"
21 
31 class vtkPlusServerExport vtkPlusCommand : public vtkObject
32 {
33 public:
34  static const std::string DEVICE_NAME_COMMAND;
35  static const std::string DEVICE_NAME_REPLY;
36 
37  virtual vtkPlusCommand* Clone() = 0;
38 
39  virtual void PrintSelf(ostream& os, vtkIndent indent);
40 
45  virtual PlusStatus Execute() = 0;
46 
48  virtual PlusStatus ReadConfiguration(vtkXMLDataElement* aConfig);
49 
51  virtual PlusStatus WriteConfiguration(vtkXMLDataElement* aConfig);
52 
54  virtual void SetCommandProcessor(vtkPlusCommandProcessor* processor);
55 
57  vtkSetMacro(ClientId, int);
58  vtkGetMacro(ClientId, int);
59 
65  virtual std::string GetDescription(const std::string& commandName) = 0;
66 
68  virtual void GetCommandNames(std::list<std::string>& cmdNames) = 0;
69 
70  void SetMetaData(const igtl::MessageBase::MetaDataMap& metaData);
71 
72  vtkGetMacro(RespondWithCommandMessage, bool);
73  vtkSetMacro(RespondWithCommandMessage, bool);
74 
75  vtkSetStdStringMacro(Name);
76  vtkGetStdStringMacro(Name);
77 
78  vtkSetStdStringMacro(DeviceName);
79  vtkGetStdStringMacro(DeviceName);
80 
81  vtkGetMacro(Id, uint32_t);
82  vtkSetMacro(Id, uint32_t);
83 
89  void PopCommandResponses(PlusCommandResponseList& responses);
90 
97  static std::string GenerateReplyDeviceName(uint32_t uid);
98 
105  static PlusStatus GenerateCommandDeviceName(const std::string& uid, std::string& outDeviceName);
106 
112  static bool IsCommandDeviceName(const std::string& deviceName);
113 
119  static bool IsReplyDeviceName(const std::string& deviceName, const std::string& uid = std::string(""));
120 
124  static std::string GetUidFromCommandDeviceName(const std::string& deviceName);
125 
129  static std::string GetPrefixFromCommandDeviceName(const std::string& deviceName);
130 
131 protected:
133  virtual vtkPlusDataCollector* GetDataCollector();
134 
136  virtual vtkIGSIOTransformRepository* GetTransformRepository();
137 
139  PlusStatus ValidateName();
140 
142  void QueueCommandResponse(PlusStatus status, const std::string& message, const std::string& error = "", const igtl::MessageBase::MetaDataMap* metaData = nullptr);
143 
144  vtkPlusCommand();
145  virtual ~vtkPlusCommand();
146 
148 
150  int ClientId;
151 
153  std::string DeviceName;
154 
156  uint32_t Id;
157 
160 
165  std::string Name;
166 
170  igtl::MessageBase::MetaDataMap MetaData;
171 
172  // Contains a list of command responses that should be forwarded to the caller
174 
175 private:
177  void operator=(const vtkPlusCommand&);
178 
179 };
180 
181 #endif
std::string Name
This is an abstract superclass for commands in the OpenIGTLink network interface for Plus.
static const std::string DEVICE_NAME_COMMAND
igsioStatus PlusStatus
Definition: PlusCommon.h:40
Creates a PlusCommand from a string. If the commands are to be executed on the main thread then call ...
vtkPlusCommandProcessor * CommandProcessor
Manages devices that record image or positional data.
const char ** deviceName
Definition: phidget22.h:1316
bool RespondWithCommandMessage
igtl::MessageBase::MetaDataMap MetaData
std::string DeviceName
const char * message
Definition: phidget22.h:2457
std::list< vtkSmartPointer< vtkPlusCommandResponse > > PlusCommandResponseList
PlusCommandResponseList CommandResponseQueue
static const std::string DEVICE_NAME_REPLY