This class allows storage and retrieval of Method objects. More...
#include <rtt/MethodRepository.hpp>
Public Types | |
typedef MethodFactory | Factory |
typedef std::vector < ArgumentDescription > | Descriptions |
The descriptions of an argumentlist. | |
typedef std::vector < DataSourceBase::shared_ptr > | Arguments |
The arguments for an operation. | |
Public Member Functions | |
void | clear () |
Clear all added methods from the repository, saving memory space. | |
std::vector< std::string > | getMethods () const |
Returns the names of all methods added to this interface. | |
bool | hasMethod (const std::string &name) const |
Query for the existence of a Method in this interface. | |
template<class MethodT > | |
bool | addMethod (MethodT *meth) |
Add a Method object to the method interface. | |
template<class Signature > | |
boost::shared_ptr < ActionInterface > | getMethod (std::string name) |
Get a previously added method for use in a C++ Method object. | |
void | removeMethod (const std::string &name) |
Removes a previously added method. | |
template<class MethodT > | |
bool | addMethod (MethodT meth, const char *description) |
Add a local method object to the interface. | |
template<class MethodT > | |
bool | addMethod (MethodT meth, const char *description, const char *arg1, const char *arg1_description) |
Add a local method object to the interface. | |
template<class MethodT > | |
bool | addMethod (MethodT meth, const char *description, const char *arg1, const char *arg1_description, const char *arg2, const char *arg2_description) |
Add a local method object to the interface. | |
template<class MethodT > | |
bool | addMethod (MethodT meth, const char *description, const char *arg1, const char *arg1_description, const char *arg2, const char *arg2_description, const char *arg3, const char *arg3_description) |
Add a local method object to the interface. | |
template<class MethodT > | |
bool | addMethod (MethodT meth, const char *description, const char *arg1, const char *arg1_description, const char *arg2, const char *arg2_description, const char *arg3, const char *arg3_description, const char *arg4, const char *arg4_description) |
Add a local method object to the interface. | |
template<class MethodT , class CompT > | |
bool | addMethodDS (DataSource< boost::weak_ptr< CompT > > *wp, MethodT c, const char *description) |
For internal use only. | |
template<class MethodT , class CompT > | |
bool | addMethodDS (DataSource< boost::weak_ptr< CompT > > *wp, MethodT c, const char *description, const char *a1, const char *d1) |
For internal use only. | |
DataSourceBase * | getMethod (std::string name, const std::vector< DataSourceBase::shared_ptr > &args) const |
For internal use only. | |
MethodC | create (std::string name) |
Create a MethodC object, a template-less method invocation object. | |
bool | resetMethod (std::string name, ActionInterface::shared_ptr impl) |
Reset the implementation of a method. | |
std::vector< std::string > | getNames () const |
Get a list of all the names of the added operations. | |
bool | hasMember (const std::string &name) const |
Query if an operation is present. | |
int | getArity (const std::string &name) const |
Query the number of arguments of an operation. | |
DataSourceBase * | produce (const std::string &name, const PropertyBag &args) const |
Produce an object that contains an operation. | |
DataSourceBase * | produce (const std::string &name, const std::vector< DataSourceBase::shared_ptr > &args) const |
Produce an object that contains an operation. | |
Descriptions | getArgumentList (const std::string &name) const |
Get the names and descriptions of all arguments of an operation. | |
std::string | getResultType (const std::string &name) const |
Get the type name of the result type of an operation. | |
std::string | getDescription (const std::string &name) const |
Get the description of an operation. | |
void | add (const std::string &name, detail::OperationFactoryPart< DataSourceBase * > *part) |
Add a new operation to the interface. | |
void | remove (const std::string &name) |
Remove an added operation from the interface. | |
Protected Types | |
typedef std::map< std::string, boost::shared_ptr < ActionInterface > > | SimpleMethods |
typedef std::map< std::string, detail::OperationFactoryPart < DataSourceBase * > * > | map_t |
Protected Attributes | |
SimpleMethods | simplemethods |
map_t | data |
This class allows storage and retrieval of Method objects.
Definition at line 60 of file MethodRepository.hpp.
void RTT::OperationFactory< DataSourceBase * >::add | ( | const std::string & | name, | |
detail::OperationFactoryPart< DataSourceBase * > * | part | |||
) | [inline, inherited] |
Add a new operation to the interface.
name | The name of the operation | |
part | A part which creates the operation. |
Definition at line 557 of file OperationFactory.hpp.
bool RTT::MethodRepository::addMethod | ( | MethodT | meth, | |
const char * | description, | |||
const char * | arg1, | |||
const char * | arg1_description, | |||
const char * | arg2, | |||
const char * | arg2_description, | |||
const char * | arg3, | |||
const char * | arg3_description, | |||
const char * | arg4, | |||
const char * | arg4_description | |||
) | [inline] |
Add a local method object to the interface.
This version of addMethod adds a Method object to the C++ interface and to the scripting interface of this component. The Method object must refer to a local method function.
meth | The method object to add. | |
description | A useful description. | |
arg1 | The name of the first argument. | |
arg1_description | The description of the first argument. | |
arg2 | The name of the second argument. | |
arg2_description | The description of the second argument. | |
arg3 | The name of the third argument. | |
arg3_description | The description of the third argument. | |
arg4 | The name of the fourth argument. | |
arg4_description | The description of the fourth argument. |
Definition at line 333 of file MethodRepository.hpp.
bool RTT::MethodRepository::addMethod | ( | MethodT | meth, | |
const char * | description, | |||
const char * | arg1, | |||
const char * | arg1_description, | |||
const char * | arg2, | |||
const char * | arg2_description, | |||
const char * | arg3, | |||
const char * | arg3_description | |||
) | [inline] |
Add a local method object to the interface.
This version of addMethod adds a Method object to the C++ interface and to the scripting interface of this component. The Method object must refer to a local method function.
meth | The method object to add. | |
description | A useful description. | |
arg1 | The name of the first argument. | |
arg1_description | The description of the first argument. | |
arg2 | The name of the second argument. | |
arg2_description | The description of the second argument. | |
arg3 | The name of the third argument. | |
arg3_description | The description of the third argument. |
Definition at line 286 of file MethodRepository.hpp.
bool RTT::MethodRepository::addMethod | ( | MethodT | meth, | |
const char * | description, | |||
const char * | arg1, | |||
const char * | arg1_description, | |||
const char * | arg2, | |||
const char * | arg2_description | |||
) | [inline] |
Add a local method object to the interface.
This version of addMethod adds a Method object to the C++ interface and to the scripting interface of this component. The Method object must refer to a local method function.
meth | The method object to add. | |
description | A useful description. | |
arg1 | The name of the first argument. | |
arg1_description | The description of the first argument. | |
arg2 | The name of the second argument. | |
arg2_description | The description of the second argument. |
Definition at line 243 of file MethodRepository.hpp.
bool RTT::MethodRepository::addMethod | ( | MethodT | meth, | |
const char * | description, | |||
const char * | arg1, | |||
const char * | arg1_description | |||
) | [inline] |
Add a local method object to the interface.
This version of addMethod adds a Method object to the C++ interface and to the scripting interface of this component. The Method object must refer to a local method function.
meth | The method object to add. | |
description | A useful description. | |
arg1 | The name of the first argument. | |
arg1_description | The description of the first argument. |
Definition at line 205 of file MethodRepository.hpp.
bool RTT::MethodRepository::addMethod | ( | MethodT | meth, | |
const char * | description | |||
) | [inline] |
Add a local method object to the interface.
This version of addMethod adds a Method object to the C++ interface and to the scripting interface of this component. The Method object must refer to a local method function.
meth | The method object to add. | |
description | A useful description. |
Definition at line 171 of file MethodRepository.hpp.
bool RTT::MethodRepository::addMethod | ( | MethodT * | meth | ) | [inline] |
Add a Method object to the method interface.
This version of addMethod does not add the Method object to the scripting interface and only to the C++ interface.
meth | The Method object to add |
Definition at line 107 of file MethodRepository.hpp.
Referenced by RTT::DataPort< T >::createPortObject(), RTT::WriteDataPort< T >::createPortObject(), and RTT::ReadDataPort< T >::createPortObject().
bool RTT::MethodRepository::addMethodDS | ( | DataSource< boost::weak_ptr< CompT > > * | wp, | |
MethodT | c, | |||
const char * | description, | |||
const char * | a1, | |||
const char * | d1 | |||
) | [inline] |
For internal use only.
The pointer of the object of which a member function must be invoked is stored in a DataSource such that the pointer can change during program execution. Required in scripting for state machines.
Definition at line 392 of file MethodRepository.hpp.
bool RTT::MethodRepository::addMethodDS | ( | DataSource< boost::weak_ptr< CompT > > * | wp, | |
MethodT | c, | |||
const char * | description | |||
) | [inline] |
For internal use only.
The pointer of the object of which a member function must be invoked is stored in a DataSource such that the pointer can change during program execution. Required in scripting for state machines.
Definition at line 368 of file MethodRepository.hpp.
MethodC RTT::MethodRepository::create | ( | std::string | name | ) | [inline] |
Create a MethodC object, a template-less method invocation object.
This function is inferior to getMethod(std::string name).
name | The name of the method |
Definition at line 434 of file MethodRepository.hpp.
Descriptions RTT::OperationFactory< DataSourceBase * >::getArgumentList | ( | const std::string & | name | ) | const [inline, inherited] |
Get the names and descriptions of all arguments of an operation.
name | The name of the operation |
Definition at line 516 of file OperationFactory.hpp.
int RTT::OperationFactory< DataSourceBase * >::getArity | ( | const std::string & | name | ) | const [inline, inherited] |
Query the number of arguments of an operation.
name | The name of the operation |
Definition at line 468 of file OperationFactory.hpp.
std::string RTT::OperationFactory< DataSourceBase * >::getDescription | ( | const std::string & | name | ) | const [inline, inherited] |
Get the description of an operation.
name | The name of the operation |
Definition at line 544 of file OperationFactory.hpp.
DataSourceBase* RTT::MethodRepository::getMethod | ( | std::string | name, | |
const std::vector< DataSourceBase::shared_ptr > & | args | |||
) | const [inline] |
For internal use only.
Get a previously added method as a DataSource. This function is inferior to getMethod(std::string name)
name | The name of the method | |
args | The arguments of the method as Data Sources. |
Definition at line 420 of file MethodRepository.hpp.
boost::shared_ptr<ActionInterface> RTT::MethodRepository::getMethod | ( | std::string | name | ) | [inline] |
Get a previously added method for use in a C++ Method object.
Store the result of this function in a Method<Signature> object.
name | The name of the method to retrieve. | |
Signature | The function signature of the method, for example: getMethod<int(double)>("name"); |
Definition at line 134 of file MethodRepository.hpp.
std::vector<std::string> RTT::MethodRepository::getMethods | ( | ) | const |
Returns the names of all methods added to this interface.
std::string RTT::OperationFactory< DataSourceBase * >::getResultType | ( | const std::string & | name | ) | const [inline, inherited] |
Get the type name of the result type of an operation.
name | The name of the operation |
Definition at line 530 of file OperationFactory.hpp.
bool RTT::MethodRepository::hasMethod | ( | const std::string & | name | ) | const |
Query for the existence of a Method in this interface.
DataSourceBase * RTT::OperationFactory< DataSourceBase * >::produce | ( | const std::string & | name, | |
const std::vector< DataSourceBase::shared_ptr > & | args | |||
) | const [inline, inherited] |
Produce an object that contains an operation.
name | The name of the operation | |
args | The arguments filled in as data sources. |
Definition at line 501 of file OperationFactory.hpp.
DataSourceBase * RTT::OperationFactory< DataSourceBase * >::produce | ( | const std::string & | name, | |
const PropertyBag & | args | |||
) | const [inline, inherited] |
Produce an object that contains an operation.
name | The name of the operation | |
args | The arguments filled in as properties. |
Definition at line 482 of file OperationFactory.hpp.
References RTT::PropertyBase::getDataSource().
void RTT::OperationFactory< DataSourceBase * >::remove | ( | const std::string & | name | ) | [inline, inherited] |
Remove an added operation from the interface.
name | The name of the operation |
Definition at line 572 of file OperationFactory.hpp.