dynamicgraph::command::Setter< E, T > Class Template Reference

Command that calls a parameter setter function. More...

#include <dynamic-graph/command-setter.h>

Inheritance diagram for dynamicgraph::command::Setter< E, T >:
Collaboration diagram for dynamicgraph::command::Setter< E, T >:

List of all members.

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.

Detailed Description

template<class E, typename T>
class dynamicgraph::command::Setter< E, T >

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.

Note:
  • T should be a type supported by class Value,
  • prototype of E::setParameter should be exactly as specified in this example.

Member Typedef Documentation

template<class E , typename T >
typedef void(E::* dynamicgraph::command::Setter< E, T >::SetterMethod)(const T &)

Pointer to method that sets paramter of type T.


Constructor & Destructor Documentation

template<class E , typename T >
dynamicgraph::command::Setter< E, T >::Setter ( E &  entity,
SetterMethod  setterMethod,
const std::string &  docString 
)

Constructor.


Member Function Documentation

template<class E , typename T >
virtual Value dynamicgraph::command::Setter< E, T >::doExecute ( ) [protected, virtual]

Specific action performed by the command.

Implements dynamicgraph::command::Command.