dynamic-graph  4.4.3
Dynamic graph library
Getter< E, T > Class Template Reference

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

Inheritance diagram for Getter< E, T >:
Collaboration diagram for Getter< E, T >:

Public Types

typedef T(E::* GetterMethod) () const
 Pointer to method that sets parameter of type T.
 

Public Member Functions

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

Protected Member Functions

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

Additional Inherited Members

- Static Public Attributes inherited from Command
static const std::vector< Value::Type > EMPTY_ARG
 

Detailed Description

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

Command that calls a parameter getter 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 getter function for this member:

class E : public Entity
{
public:
E (const std::string& inName) : Entity(inName) {}
T getParameter() const {return parameter_;}
private:
T parameter_;
};

Then the command defined by:

E entity("MyEntity");
Getter<E,T> command(entity, &E::getParameter)

returns the value of entity.parameter_ upon invocation.

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

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


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