7 #ifndef DYNAMIC_GRAPH_COMMAND_SETTER_T_CPP
8 #define DYNAMIC_GRAPH_COMMAND_SETTER_T_CPP
10 #include "dynamic-graph/command-setter.h"
12 #include <boost/assign/list_of.hpp>
15 #include "dynamic-graph/linear-algebra.h"
41 const std::string &docString)
42 :
Command(entity, boost::assign::list_of(
Value::BOOL), docString),
43 setterMethod_(setterMethod) {}
49 bool value = values[0].value();
50 E &entity =
static_cast<E &
>(
owner());
51 (entity.*setterMethod_)(value);
75 const std::string &docString)
76 :
Command(entity, boost::assign::list_of(
Value::UNSIGNED), docString),
77 setterMethod_(setterMethod) {}
83 unsigned value = values[0].value();
84 E &entity =
static_cast<E &
>(
owner());
85 (entity.*setterMethod_)(value);
109 const std::string &docString)
110 :
Command(entity, boost::assign::list_of(
Value::UNSIGNEDLONGINT),
112 setterMethod_(setterMethod) {}
118 std::uint64_t value = values[0].value();
119 E &entity =
static_cast<E &
>(
owner());
120 (entity.*setterMethod_)(value);
144 const std::string &docString)
145 :
Command(entity, boost::assign::list_of(
Value::INT), docString),
146 setterMethod_(setterMethod) {}
152 int value = values[0].value();
153 E &entity =
static_cast<E &
>(
owner());
154 (entity.*setterMethod_)(value);
178 const std::string &docString)
179 :
Command(entity, boost::assign::list_of(
Value::LONGINT), docString),
180 setterMethod_(setterMethod) {}
186 std::int64_t value = values[0].value();
187 E &entity =
static_cast<E &
>(
owner());
188 (entity.*setterMethod_)(value);
212 const std::string &docString)
213 :
Command(entity, boost::assign::list_of(
Value::FLOAT), docString),
214 setterMethod_(setterMethod) {}
220 float value = values[0].value();
221 E &entity =
static_cast<E &
>(
owner());
222 (entity.*setterMethod_)(value);
246 const std::string &docString)
247 :
Command(entity, boost::assign::list_of(
Value::DOUBLE), docString),
248 setterMethod_(setterMethod) {}
254 double value = values[0].value();
255 E &entity =
static_cast<E &
>(
owner());
256 (entity.*setterMethod_)(value);
280 const std::string &docString)
281 :
Command(entity, boost::assign::list_of(
Value::STRING), docString),
282 setterMethod_(setterMethod) {}
288 std::string value = values[0].value();
289 E &entity =
static_cast<E &
>(
owner());
290 (entity.*setterMethod_)(value);
314 const std::string &docString)
315 :
Command(entity, boost::assign::list_of(
Value::VECTOR), docString),
316 setterMethod_(setterMethod) {}
322 Vector value = values[0].value();
323 E &entity =
static_cast<E &
>(
owner());
324 (entity.*setterMethod_)(value);
348 const std::string &docString)
349 :
Command(entity, boost::assign::list_of(
Value::MATRIX), docString),
350 setterMethod_(setterMethod) {}
356 Matrix value = values[0].value();
357 E &entity =
static_cast<E &
>(
owner());
358 (entity.*setterMethod_)(value);
const std::vector< Value > & getParameterValues() const
Get parameter values.
Entity & owner()
Get a reference to the Entity owning this command.
void(E::* SetterMethod)(const T &)
Pointer to method that sets parameter of type T.
virtual Value doExecute()
Specific action performed by the command.
Setter(E &entity, SetterMethod setterMethod, const std::string &docString)
Constructor.
This class implements a variant design pattern to handle basic types in Command.