Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
dynamicgraph::command::Setter< E, T > Class Template Reference

#include <command-setter.h>

Inheritance diagram for dynamicgraph::command::Setter< E, T >:
Inheritance graph
[legend]

Public Types

typedef void(E::* SetterMethod) (const T &)
 Pointer to method that sets parameter of type T. More...
 

Public Member Functions

 Setter (E &entity, SetterMethod setterMethod, const std::string &docString)
 Constructor. More...
 
- Public Member Functions inherited from dynamicgraph::command::Command
 Command (Entity &entity, const std::vector< Value::Type > &valueTypes, const std::string &docstring)
 
Value execute ()
 Execute the command after checking parameters. More...
 
std::string getDocstring () const
 Get documentation string. More...
 
const std::vector< Value > & getParameterValues () const
 Get parameter values. More...
 
Entityowner ()
 Get a reference to the Entity owning this command. More...
 
void setParameterValues (const std::vector< Value > &values)
 Set parameter values. More...
 
const std::vector< Value::Type > & valueTypes () const
 Return the value type of all parameters. More...
 
virtual ~Command ()
 

Protected Member Functions

virtual Value doExecute ()
 Specific action performed by the command. More...
 

Private Attributes

SetterMethod setterMethod_
 

Additional Inherited Members

- Static Public Attributes inherited from dynamicgraph::command::Command
static const std::vector< Value::TypeEMPTY_ARG = std::vector<Value::Type>()
 

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.

Definition at line 45 of file command-setter.h.

Member Typedef Documentation

◆ SetterMethod

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

Pointer to method that sets parameter of type T.

Definition at line 48 of file command-setter.h.

Constructor & Destructor Documentation

◆ Setter()

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

Constructor.

Member Function Documentation

◆ doExecute()

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

Specific action performed by the command.

Implements dynamicgraph::command::Command.

Member Data Documentation

◆ setterMethod_

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

Definition at line 56 of file command-setter.h.


The documentation for this class was generated from the following file:


dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Sun Jun 25 2023 02:06:03