Command that calls a parameter setter function. More...
#include <dynamic-graph/command-setter.h>
Public Types | |
typedef void(E::* | SetterMethod )(const T &) |
Pointer to method that sets paramter of type T. | |
Public Member Functions | |
Setter (E &entity, SetterMethod setterMethod, const std::string &docString) | |
Constructor. | |
Protected Member Functions | |
virtual Value | doExecute () |
Specific action performed by the command. |
Command that calls a parameter setter function.
This class is templated by a type E deriving from entity and a type T of data.
Let us assume that class E has a private member of type T and a public setter function for this member:
class E : public Entity { public: E (const std::string& inName) : Entity(inName) {} void setParameter(const T& parameter) {parameter_ = parameter;} private: T parameter_; };
Then the command defined by:
E entity("MyEntity");
Setter<E,T> command(entity, &E::getParameter)
sets the value of entity.parameter_
upon invocation.
typedef void(E::* dynamicgraph::command::Setter< E, T >::SetterMethod)(const T &) |
Pointer to method that sets paramter of type T.
dynamicgraph::command::Setter< E, T >::Setter | ( | E & | entity, |
SetterMethod | setterMethod, | ||
const std::string & | docString | ||
) |
Constructor.
virtual Value dynamicgraph::command::Setter< E, T >::doExecute | ( | ) | [protected, virtual] |
Specific action performed by the command.
Implements dynamicgraph::command::Command.