dynamic-graph  4.4.3
Dynamic graph library
command.h
1 //
2 // Copyright 2010 CNRS
3 //
4 // Author: Florent Lamiraux
5 //
6 
7 #ifndef DYNAMIC_GRAPH_COMMAND_H
8 #define DYNAMIC_GRAPH_COMMAND_H
9 
10 #include <vector>
11 
12 #include "dynamic-graph/dynamic-graph-api.h"
13 #include "dynamic-graph/value.h"
14 
15 namespace dynamicgraph {
16 class Entity;
17 namespace command {
35 class DYNAMIC_GRAPH_DLLAPI Command {
36  public:
37  virtual ~Command();
42  Command(Entity &entity, const std::vector<Value::Type> &valueTypes,
43  const std::string &docstring);
45  const std::vector<Value::Type> &valueTypes() const;
47  void setParameterValues(const std::vector<Value> &values);
49  const std::vector<Value> &getParameterValues() const;
55  std::string getDocstring() const;
56 
57  protected:
59  virtual Value doExecute() = 0;
60 
61  private:
62  Entity &owner_;
63  std::vector<Value::Type> valueTypeVector_;
64  std::vector<Value> valueVector_;
65  std::string docstring_;
66 
67  public:
68  static const std::vector<Value::Type> EMPTY_ARG;
69 };
70 } // namespace command
71 } // namespace dynamicgraph
72 
73 #endif // DYNAMIC_GRAPH_COMMAND_H
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
Definition: entity.h:52
const std::vector< Value > & getParameterValues() const
Get parameter values.
Command(Entity &entity, const std::vector< Value::Type > &valueTypes, const std::string &docstring)
Value execute()
Execute the command after checking parameters.
const std::vector< Value::Type > & valueTypes() const
Return the value type of all parameters.
std::string getDocstring() const
Get documentation string.
void setParameterValues(const std::vector< Value > &values)
Set parameter values.
virtual Value doExecute()=0
Specific action performed by the command.
Entity & owner()
Get a reference to the Entity owning this command.
This class implements a variant design pattern to handle basic types in Command.
Definition: value.h:51