RTT::CommandRepository Class Reference
[Command Interface]

A command repository stores a number of commands from a Task which can be used by other tasks or from scripts. More...

#include <rtt/CommandRepository.hpp>

Inheritance diagram for RTT::CommandRepository:
RTT::OperationFactory< DispatchInterface * >

List of all members.

Public Types

typedef CommandFactory 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

template<class Signature >
DispatchInterfacegetCommand (std::string name)
 Return the pointer to an added command for use in a Command object.
void clear ()
 Clears the complete interface and frees all memory.
std::vector< std::string > getCommands () const
 Returns the names of all commands added to this interface.
bool hasCommand (const std::string &name) const
 Query for the existence of a Command in this interface.
void removeCommand (const std::string &name)
 Removes a previously added command.
template<class CommandT >
bool addCommand (CommandT *com)
 Add a Command object to the command interface.
template<class CommandT >
bool addCommand (CommandT com, const char *description)
 Add a Command object, which takes no arguments, to the command interface.
template<class CommandT >
bool addCommand (CommandT com, const char *description, const char *arg1, const char *arg1_description)
 Add a Command object, which takes one argument, to the command interface.
template<class CommandT >
bool addCommand (CommandT com, const char *description, const char *arg1, const char *arg1_description, const char *arg2, const char *arg2_description)
 Add a Command object, which takes two arguments, to the command interface.
template<class CommandT >
bool addCommand (CommandT com, 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 Command object, which takes three arguments, to the command interface.
template<class CommandT >
bool addCommand (CommandT com, 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 Command object, which takes four arguments, to the command interface.
DispatchInterfacegetCommand (std::string name, const std::vector< DataSourceBase::shared_ptr > &args) const
 For internal use only.
template<class CommandT , class CompT >
bool addCommandDS (DataSource< boost::weak_ptr< CompT > > *wp, CommandT c, const char *description)
 For internal use only.
template<class CommandT , class CompT >
bool addCommandDS (DataSource< boost::weak_ptr< CompT > > *wp, CommandT c, const char *description, const char *arg1, const char *arg1_description)
 For internal use only.
ConditionInterfacegetCondition (std::string name, const std::vector< DataSourceBase::shared_ptr > &args) const
 For internal use Only.
CommandC create (std::string name)
 Create a CommandC container object, which can be used to access an added Command.
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.
DispatchInterfaceproduce (const std::string &name, const PropertyBag &args) const
 Produce an object that contains an operation.
DispatchInterfaceproduce (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< DispatchInterface * > *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
< DispatchInterface * > * > 
map_t

Protected Attributes

map_t data

Detailed Description

A command repository stores a number of commands from a Task which can be used by other tasks or from scripts.

Definition at line 60 of file CommandRepository.hpp.


Member Function Documentation

void RTT::OperationFactory< DispatchInterface * >::add ( const std::string &  name,
detail::OperationFactoryPart< DispatchInterface * > *  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.

template<class CommandT >
bool RTT::CommandRepository::addCommand ( CommandT  com,
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 Command object, which takes four arguments, to the command interface.

The command is added to the C++ and to the scripting interface.

Parameters:
c A pointer to the Command object.
description A user readable description of what this command does.
arg1 A single word name of the first argument.
arg1_description A user readable description of the first argument.
arg2 A single word name of the second argument.
arg2_description A user readable description of the second argument.
arg3 A single word name of the third argument.
arg3_description A user readable description of the third argument.
arg4 A single word name of the fourth argument.
arg4_description A user readable description of the fourth argument.
Returns:
true if the command could be added.

Definition at line 340 of file CommandRepository.hpp.

template<class CommandT >
bool RTT::CommandRepository::addCommand ( CommandT  com,
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 Command object, which takes three arguments, to the command interface.

The command is added to the C++ and to the scripting interface.

Parameters:
c A pointer to the Command object.
description A user readable description of what this command does.
arg1 A single word name of the first argument.
arg1_description A user readable description of the first argument.
arg2 A single word name of the second argument.
arg2_description A user readable description of the second argument.
arg3 A single word name of the third argument.
arg3_description A user readable description of the third argument.
Returns:
true if the command could be added.

Definition at line 292 of file CommandRepository.hpp.

template<class CommandT >
bool RTT::CommandRepository::addCommand ( CommandT  com,
const char *  description,
const char *  arg1,
const char *  arg1_description,
const char *  arg2,
const char *  arg2_description 
) [inline]

Add a Command object, which takes two arguments, to the command interface.

The command is added to the C++ and to the scripting interface.

Parameters:
c A pointer to the Command object.
description A user readable description of what this command does.
arg1 A single word name of the first argument.
arg1_description A user readable description of the first argument.
arg2 A single word name of the second argument.
arg2_description A user readable description of the second argument.
Returns:
true if the command could be added.

Definition at line 247 of file CommandRepository.hpp.

template<class CommandT >
bool RTT::CommandRepository::addCommand ( CommandT  com,
const char *  description,
const char *  arg1,
const char *  arg1_description 
) [inline]

Add a Command object, which takes one argument, to the command interface.

The command is added to the C++ and to the scripting interface.

Parameters:
c A pointer to the existing command.
description A user readable description of what this command does.
arg1 A single word name of the argument.
arg1_description A user readable description of the argument.
Returns:
true if the command could be added.

Definition at line 207 of file CommandRepository.hpp.

template<class CommandT >
bool RTT::CommandRepository::addCommand ( CommandT  com,
const char *  description 
) [inline]

Add a Command object, which takes no arguments, to the command interface.

The command is added to the C++ and to the scripting interface.

Parameters:
c A pointer to the existing command.
description A user readable description of what this command does.
Returns:
true if the command could be added.

Definition at line 168 of file CommandRepository.hpp.

template<class CommandT >
bool RTT::CommandRepository::addCommand ( CommandT *  com  )  [inline]

Add a Command object to the command interface.

The command is added to the C++ interface and not added to the scripting interface.

See also:
getCommand to retrieve it.
Parameters:
com A pointer to a Command object.
Returns:
true if the command could be added.

Definition at line 142 of file CommandRepository.hpp.

template<class CommandT , class CompT >
bool RTT::CommandRepository::addCommandDS ( DataSource< boost::weak_ptr< CompT > > *  wp,
CommandT  c,
const char *  description,
const char *  arg1,
const char *  arg1_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 414 of file CommandRepository.hpp.

template<class CommandT , class CompT >
bool RTT::CommandRepository::addCommandDS ( DataSource< boost::weak_ptr< CompT > > *  wp,
CommandT  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 391 of file CommandRepository.hpp.

CommandC RTT::CommandRepository::create ( std::string  name  )  [inline]

Create a CommandC container object, which can be used to access an added Command.

Parameters:
name The name of the Command
Returns:
A new CommandC object.

Definition at line 457 of file CommandRepository.hpp.

Descriptions RTT::OperationFactory< DispatchInterface * >::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.

int RTT::OperationFactory< DispatchInterface * >::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.

DispatchInterface* RTT::CommandRepository::getCommand ( std::string  name,
const std::vector< DataSourceBase::shared_ptr > &  args 
) const [inline]

For internal use only.

Retrieve a previously added Command.

Parameters:
name The name of the Command
args A vector of command arguments.
Returns:
A dispatchable object which is a new Command object.

Definition at line 379 of file CommandRepository.hpp.

template<class Signature >
DispatchInterface* RTT::CommandRepository::getCommand ( std::string  name  )  [inline]

Return the pointer to an added command for use in a Command object.

Store the result in a Command<Signature> object.

Parameters:
name The name of the command to retrieve.
Signature The function signature of the command, for example: getCommand<bool(int,double)>("name");
Returns:
A new pointer to a Command, or null if it does not exist.

Definition at line 90 of file CommandRepository.hpp.

std::vector<std::string> RTT::CommandRepository::getCommands (  )  const

Returns the names of all commands added to this interface.

See also:
getNames() to get a list of all commands available to scripting.
ConditionInterface* RTT::CommandRepository::getCondition ( std::string  name,
const std::vector< DataSourceBase::shared_ptr > &  args 
) const [inline]

For internal use Only.

Retrieve the completion condition of a previously added Command.

Parameters:
name The name of the Command
args A vector of command arguments
Returns:
A condition which evaluates the command's completion.

Definition at line 440 of file CommandRepository.hpp.

std::string RTT::OperationFactory< DispatchInterface * >::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.

std::string RTT::OperationFactory< DispatchInterface * >::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.

bool RTT::CommandRepository::hasCommand ( const std::string &  name  )  const

Query for the existence of a Command in this interface.

See also:
hasMember() to verify if a command is available to scripting as well.
DispatchInterface * RTT::OperationFactory< DispatchInterface * >::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.

DispatchInterface * RTT::OperationFactory< DispatchInterface * >::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.

void RTT::OperationFactory< DispatchInterface * >::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 Thu Dec 23 13:22:40 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3