dynamic-graph  4.1.0-8-gdab7-dirty
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 "dynamic-graph/dynamic-graph-api.h"
11 #include "dynamic-graph/value.h"
12 #include <vector>
13 
14 namespace dynamicgraph {
15 class Entity;
16 namespace command {
34 class DYNAMIC_GRAPH_DLLAPI Command {
35 public:
36  virtual ~Command();
41  Command(Entity &entity, const std::vector<Value::Type> &valueTypes,
42  const std::string &docstring);
44  const std::vector<Value::Type> &valueTypes() const;
46  void setParameterValues(const std::vector<Value> &values);
48  const std::vector<Value> &getParameterValues() const;
50  Value execute();
52  Entity &owner();
54  std::string getDocstring() const;
55 
56 protected:
58  virtual Value doExecute() = 0;
59 
60 private:
61  Entity &owner_;
62  std::vector<Value::Type> valueTypeVector_;
63  std::vector<Value> valueVector_;
64  std::string docstring_;
65 
66 public:
67  static const std::vector<Value::Type> EMPTY_ARG;
68 };
69 } // namespace command
70 } // namespace dynamicgraph
71 
72 #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:53
This class implements a variant design pattern to handle basic types in Command.
Definition: value.h:46