MethodRepository Class Reference
[Method Interface]

#include <rtt/MethodRepository.hpp>

Inheritance diagram for MethodRepository:

OperationFactory

List of all members.


Detailed Description

This class allows storage and retrieval of Method objects.

Definition at line 57 of file 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

 ~MethodRepository ()
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.
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.
DataSourceBasegetMethod (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.
ResultT produce (const std::string &name, const PropertyBag &args) const
 Produce an object that contains an operation.
ResultT 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< ResultT > *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,
detail::OperationFactoryPart
< ResultT > * > 
map_t

Protected Attributes

std::map
< std::string,
boost::shared_ptr
< ActionInterface > > 
simplemethods
map_t data

Member Function Documentation

std::vector<std::string> getMethods (  )  const [inline]

Returns the names of all methods added to this interface.

See also:
getNames() to get a list of all methods available to scripting.

Definition at line 93 of file MethodRepository.hpp.

References RTT::keys(), and MethodRepository::simplemethods.

bool hasMethod ( const std::string &  name  )  const [inline]

Query for the existence of a Method in this interface.

See also:
hasMember() to verify if a method is available to scripting as well.

Definition at line 101 of file MethodRepository.hpp.

References MethodRepository::simplemethods.

Referenced by MethodRepository::resetMethod().

bool 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.

Parameters:
meth The Method object to add
Returns:
true if it could be added, false otherwise.

Definition at line 115 of file MethodRepository.hpp.

References RTT::Debug, RTT::Error, and MethodRepository::simplemethods.

Referenced by DataPort::createPortObject(), WriteDataPort::createPortObject(), ReadDataPort::createPortObject(), BufferPort::createPortObject(), WriteBufferPort::createPortObject(), ReadBufferPort::createPortObject(), ParserScriptingAccess::createTaskObject(), MarshallingAccess::MarshallingAccess(), Orocos_ControlTask_i::Orocos_ControlTask_i(), ParserExecutionAccess::ParserExecutionAccess(), and TaskContext::setup().

boost::shared_ptr<ActionInterface> 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.

Parameters:
name The name of the method to retrieve.
Signature The function signature of the method, for example: getMethod<int(double)>("name");
Returns:
true if it could be found, false otherwise.

Definition at line 143 of file MethodRepository.hpp.

References RTT::Error, MethodRepository::simplemethods, and RTT::Warning.

bool 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.

Parameters:
meth The method object to add.
description A useful description.
Returns:
true if it could be added.

Definition at line 170 of file MethodRepository.hpp.

References RTT::Error, and LocalMethod::getMethodFunction().

bool 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.

Parameters:
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.
Returns:
true if it could be added.

Definition at line 204 of file MethodRepository.hpp.

References RTT::Error, and LocalMethod::getMethodFunction().

bool 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.

Parameters:
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.
Returns:
true if it could be added.

Definition at line 242 of file MethodRepository.hpp.

References RTT::Error, and LocalMethod::getMethodFunction().

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 
) [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.

Parameters:
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.
Returns:
true if it could be added.

Definition at line 285 of file MethodRepository.hpp.

References RTT::Error, and LocalMethod::getMethodFunction().

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 
) [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.

Parameters:
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.
Returns:
true if it could be added.

Definition at line 332 of file MethodRepository.hpp.

References RTT::Error, and LocalMethod::getMethodFunction().

bool 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 367 of file MethodRepository.hpp.

References LocalMethod::getMethodFunction().

Referenced by ProgramTask::ProgramTask().

bool 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 391 of file MethodRepository.hpp.

References LocalMethod::getMethodFunction().

DataSourceBase* 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)

Parameters:
name The name of the method
args The arguments of the method as Data Sources.
Returns:
A DataSource which, when evaluated, invokes the method.

Definition at line 419 of file MethodRepository.hpp.

References OperationFactory::produce().

MethodC create ( std::string  name  )  [inline]

Create a MethodC object, a template-less method invocation object.

This function is inferior to getMethod(std::string name).

Parameters:
name The name of the method
Returns:
An object which can invoke a method.

Definition at line 433 of file MethodRepository.hpp.

int getArity ( const std::string &  name  )  const [inline, inherited]

Query the number of arguments of an operation.

Parameters:
name The name of the operation
Returns:
The arity, or -1 if name is not found.

Definition at line 468 of file OperationFactory.hpp.

Referenced by EventService::arity(), MethodC::D::checkAndCreate(), CommandC::D::checkAndCreate(), MethodC::execute(), and CommandC::execute().

ResultT produce ( const std::string &  name,
const PropertyBag args 
) const [inline, inherited]

Produce an object that contains an operation.

Parameters:
name The name of the operation
args The arguments filled in as properties.
Returns:
a new object.

Definition at line 482 of file OperationFactory.hpp.

Referenced by MethodC::D::checkAndCreate(), CommandC::D::checkAndCreate(), CommandRepository::getCommand(), CommandRepository::getCondition(), EventService::getEvent(), and MethodRepository::getMethod().

ResultT produce ( const std::string &  name,
const std::vector< DataSourceBase::shared_ptr > &  args 
) const [inline, inherited]

Produce an object that contains an operation.

Parameters:
name The name of the operation
args The arguments filled in as data sources.
Returns:
a new object

Definition at line 501 of file OperationFactory.hpp.

Descriptions getArgumentList ( const std::string &  name  )  const [inline, inherited]

Get the names and descriptions of all arguments of an operation.

Parameters:
name The name of the operation
Returns:
A list of descriptions.

Definition at line 516 of file OperationFactory.hpp.

std::string getResultType ( const std::string &  name  )  const [inline, inherited]

Get the type name of the result type of an operation.

Parameters:
name The name of the operation
Returns:
A name of a data type.

Definition at line 530 of file OperationFactory.hpp.

std::string getDescription ( const std::string &  name  )  const [inline, inherited]

Get the description of an operation.

Parameters:
name The name of the operation
Returns:
A user readable description.

Definition at line 544 of file OperationFactory.hpp.

void add ( const std::string &  name,
detail::OperationFactoryPart< ResultT > *  part 
) [inline, inherited]

Add a new operation to the interface.

Parameters:
name The name of the operation
part A part which creates the operation.

Definition at line 557 of file OperationFactory.hpp.

Referenced by ControlTaskProxy::fetchObjects(), and ControlTaskProxy::synchronize().

void remove ( const std::string &  name  )  [inline, inherited]

Remove an added operation from the interface.

Parameters:
name The name of the operation

Definition at line 572 of file OperationFactory.hpp.


The documentation for this class was generated from the following file:
Generated on Tue Mar 25 17:41:56 2008 for OrocosReal-TimeToolkit by  doxygen 1.5.3