Orocos Real-Time Toolkit  2.6.0
Public Member Functions | Protected Member Functions | Protected Attributes
RTT::Operation< Signature > Class Template Reference

The operation ties a C or C++ function into a component interface. More...

#include <rtt/Operation.hpp>

Inheritance diagram for RTT::Operation< Signature >:
RTT::base::OperationBase

List of all members.

Public Member Functions

 Operation (const std::string &name)
 Create an operation object with a name.
 Operation (const std::string &name, boost::function< Signature > func, ExecutionThread et=ClientThread, ExecutionEngine *ee=NULL)
 Create an operation object with a name and function to execute.
template<class Function , class Object >
 Operation (const std::string &name, Function func, Object o, ExecutionThread et=ClientThread, ExecutionEngine *ee=NULL)
 Create an operation object with a name and class member function to execute.
Operation< Signature > & doc (const std::string &description)
 Document this operation.
Operation< Signature > & arg (const std::string &name, const std::string &description)
 Document an argument of this operation.
Operationcalls (boost::function< Signature > func, ExecutionThread et=ClientThread, ExecutionEngine *ownerEngine=NULL)
 Indicate that this operation calls a given function.
template<class Function , class Object >
Operationcalls (Function func, Object o, ExecutionThread et=ClientThread, ExecutionEngine *ownerEngine=NULL)
 Indicate that this operation calls a given class member function.
virtual
base::DisposableInterface::shared_ptr 
getImplementation ()
 Returns the implementation object of this operation.
virtual const
base::DisposableInterface::shared_ptr 
getImplementation () const
virtual
base::OperationCallerBase
< Signature >::shared_ptr 
getOperationCaller ()
virtual const
base::OperationCallerBase
< Signature >::shared_ptr 
getOperationCaller () const
const std::string & getName ()
 Returns the name of this operation.
const std::vector< std::string > & getDescriptions ()
 Returns all the documented descriptions of this operation, as a single list, starting with the operation's description, followed by the name, description pairs of each argument.
bool ready () const
 An operation is ready if it has an implementation and is present in a TaskContext.
void setOwner (ExecutionEngine *ee)
 Updates the owning ExecutionEngine that might execute this operation.

Protected Member Functions

RTT_API void mdoc (const std::string &description)
RTT_API void marg (const std::string &name, const std::string &description)

Protected Attributes

std::string mname
std::vector< std::string > descriptions
ExecutionEnginemowner

Detailed Description

template<class Signature>
class RTT::Operation< Signature >

The operation ties a C or C++ function into a component interface.

An operation consists of a name and a Signature.

For example, if you want his operation to call a function: bool foo(int a, double b) { return a < b; } Then the function Signature looks like: 'bool(int,double)' which is the signature type of 'bool foo(int a, double b)'. So a function signature is written as the function declaration, but without the function and argument names.

Parameters:
SignatureA template parameter that contains the function signature type of the function this operation object will call.

Definition at line 71 of file Operation.hpp.


Constructor & Destructor Documentation

template<class Signature>
RTT::Operation< Signature >::Operation ( const std::string &  name) [inline]

Create an operation object with a name.

The resulting object will not call any function but can be used to attach Signal handlers to (using signals() ) or set the function to call later on with calls().

Parameters:
nameThe name of this instance.

Definition at line 82 of file Operation.hpp.

template<class Signature>
RTT::Operation< Signature >::Operation ( const std::string &  name,
boost::function< Signature >  func,
ExecutionThread  et = ClientThread,
ExecutionEngine ee = NULL 
) [inline]

Create an operation object with a name and function to execute.

Parameters:
nameThe name of this instance.
funcThe function to execute, for example &foo.
etThe thread that should execute the function when the operation is invoked.
ownerEnginethe execution engine of the owner of this operation if any.

Definition at line 97 of file Operation.hpp.

References RTT::Operation< Signature >::calls().

template<class Signature>
template<class Function , class Object >
RTT::Operation< Signature >::Operation ( const std::string &  name,
Function  func,
Object  o,
ExecutionThread  et = ClientThread,
ExecutionEngine ee = NULL 
) [inline]

Create an operation object with a name and class member function to execute.

Parameters:
nameThe name of this instance.
funcThe function to execute, for example &Bar::foo
oThe object that has this function, for example &bar
etThe thread that should execute the function when the operation is invoked.
ownerEnginethe execution engine of the owner of this operation if any.

Definition at line 112 of file Operation.hpp.

References RTT::Operation< Signature >::calls().


Member Function Documentation

template<class Signature>
Operation<Signature>& RTT::Operation< Signature >::arg ( const std::string &  name,
const std::string &  description 
) [inline]

Document an argument of this operation.

Each time arg() is called, it documents the next argument.

Parameters:
nameA single word (identifier) denoting the name of this argument
descriptionA descriptive line of text for this argument
Returns:
A reference to this object.

Definition at line 136 of file Operation.hpp.

template<class Signature>
Operation& RTT::Operation< Signature >::calls ( boost::function< Signature >  func,
ExecutionThread  et = ClientThread,
ExecutionEngine ownerEngine = NULL 
) [inline]

Indicate that this operation calls a given function.

This will replace any previously registered function present in this operation.

Parameters:
funcThe function to call when the operation is invoked
etThe thread that should execute the function when the operation is invoked.
ownerEnginethe execution engine of the owner of this operation if any.
Returns:
A reference to this object.

Definition at line 146 of file Operation.hpp.

Referenced by RTT::Operation< Signature >::Operation().

template<class Signature>
template<class Function , class Object >
Operation& RTT::Operation< Signature >::calls ( Function  func,
Object  o,
ExecutionThread  et = ClientThread,
ExecutionEngine ownerEngine = NULL 
) [inline]

Indicate that this operation calls a given class member function.

This will replace any previously registered function present in this operation.

Parameters:
funcThe function to call when the operation is invoked, for example &Bar::foo
oThe object that has this function, for example &bar
etThe thread that should execute the function when the operation is invoked.
ownerEnginethe execution engine of the owner of this operation if any.
Returns:
A reference to this object.

Definition at line 167 of file Operation.hpp.

template<class Signature>
Operation<Signature>& RTT::Operation< Signature >::doc ( const std::string &  description) [inline]

Document this operation.

Parameters:
descriptionA descriptive line of text.
Returns:
A reference to this object.

Definition at line 127 of file Operation.hpp.

const std::vector<std::string>& RTT::base::OperationBase::getDescriptions ( ) [inline, inherited]

Returns all the documented descriptions of this operation, as a single list, starting with the operation's description, followed by the name, description pairs of each argument.

In case no argument was documented, only the description of the operation is returned.

Returns:
A vector with all documented descriptions.

Definition at line 92 of file OperationBase.hpp.

template<class Signature>
virtual base::DisposableInterface::shared_ptr RTT::Operation< Signature >::getImplementation ( ) [inline, virtual]

Returns the implementation object of this operation.

Returns:

Implements RTT::base::OperationBase.

Definition at line 207 of file Operation.hpp.

const std::string& RTT::base::OperationBase::getName ( ) [inline, inherited]

Returns the name of this operation.

Returns:
The name.

Definition at line 83 of file OperationBase.hpp.

Referenced by RTT::Service::addLocalOperation(), RTT::Service::addOperation(), RTT::Service::addOperationDS(), and RTT::Service::addSynchronousOperation().

bool RTT::base::OperationBase::ready ( ) const [inline, inherited]

An operation is ready if it has an implementation and is present in a TaskContext.

Returns:
true if ready.

Definition at line 107 of file OperationBase.hpp.

References RTT::base::OperationBase::getImplementation().

void RTT::base::OperationBase::setOwner ( ExecutionEngine ee) [inline, inherited]

Updates the owning ExecutionEngine that might execute this operation.

Parameters:
ee

Definition at line 115 of file OperationBase.hpp.

Referenced by RTT::Service::addLocalOperation().


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