7 #ifndef DYNAMIC_GRAPH_COMMAND_SETTER_T_CPP 8 #define DYNAMIC_GRAPH_COMMAND_SETTER_T_CPP 10 #include "dynamic-graph/command-setter.h" 11 #include "dynamic-graph/linear-algebra.h" 12 #include <boost/assign/list_of.hpp> 38 const std::string &docString)
39 :
Command(entity, boost::assign::list_of(
Value::BOOL), docString),
40 setterMethod_(setterMethod) {}
45 bool value = values[0].value();
46 E &entity =
static_cast<E &
>(
owner());
47 (entity.*setterMethod_)(value);
70 const std::string &docString)
71 :
Command(entity, boost::assign::list_of(
Value::UNSIGNED), docString),
72 setterMethod_(setterMethod) {}
77 unsigned value = values[0].value();
78 E &entity =
static_cast<E &
>(
owner());
79 (entity.*setterMethod_)(value);
102 const std::string &docString)
103 :
Command(entity, boost::assign::list_of(
Value::INT), docString),
104 setterMethod_(setterMethod) {}
109 int value = values[0].value();
110 E &entity =
static_cast<E &
>(
owner());
111 (entity.*setterMethod_)(value);
134 const std::string &docString)
135 :
Command(entity, boost::assign::list_of(
Value::FLOAT), docString),
136 setterMethod_(setterMethod) {}
141 float value = values[0].value();
142 E &entity =
static_cast<E &
>(
owner());
143 (entity.*setterMethod_)(value);
166 const std::string &docString)
167 :
Command(entity, boost::assign::list_of(
Value::DOUBLE), docString),
168 setterMethod_(setterMethod) {}
173 double value = values[0].value();
174 E &entity =
static_cast<E &
>(
owner());
175 (entity.*setterMethod_)(value);
198 const std::string &docString)
199 :
Command(entity, boost::assign::list_of(
Value::STRING), docString),
200 setterMethod_(setterMethod) {}
205 std::string value = values[0].value();
206 E &entity =
static_cast<E &
>(
owner());
207 (entity.*setterMethod_)(value);
230 const std::string &docString)
231 :
Command(entity, boost::assign::list_of(
Value::VECTOR), docString),
232 setterMethod_(setterMethod) {}
237 Vector value = values[0].value();
238 E &entity =
static_cast<E &
>(
owner());
239 (entity.*setterMethod_)(value);
262 const std::string &docString)
263 :
Command(entity, boost::assign::list_of(
Value::MATRIX), docString),
264 setterMethod_(setterMethod) {}
269 Matrix value = values[0].value();
270 E &entity =
static_cast<E &
>(
owner());
271 (entity.*setterMethod_)(value);
278 #endif // DYNAMIC_GRAPH_COMMAND_SETTER_T_CPP Entity & owner()
Get a reference to the Entity owning this command.
This class implements a variant design pattern to handle basic types in Command.
Setter(E &entity, SetterMethod setterMethod, const std::string &docString)
Constructor.
void(E::* SetterMethod)(const T &)
Pointer to method that sets parameter of type T.
const std::vector< Value > & getParameterValues() const
Get parameter values.
virtual Value doExecute()
Specific action performed by the command.