Orocos Real-Time Toolkit  2.6.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
RTT::Service Class Reference

This class allows storage and retrieval of operations, attributes and properties provided by a component. More...

#include <rtt/Service.hpp>

Inheritance diagram for RTT::Service:
RTT::OperationInterface RTT::ConfigurationInterface RTT::DataFlowInterface RTT::internal::GlobalService RTT::marsh::MarshallingService RTT::scripting::ProgramService RTT::scripting::ScriptingService RTT::scripting::StateMachineService

List of all members.

Public Types

typedef OperationInterface Factory
typedef boost::shared_ptr
< Service
shared_ptr
typedef std::vector< std::string > ProviderNames
typedef std::vector
< base::DataSourceBase::shared_ptr
Arguments
 The arguments for an operation.
typedef std::vector
< ArgumentDescription
Descriptions
 The descriptions of an argumentlist.
typedef std::vector< std::string > AttributeNames
 A vector containing the names of all attribute objects in this repository.
typedef std::vector
< base::AttributeBase * > 
AttributeObjects
 A vector containing pointers to all attribute objects stored in this repository.
typedef std::vector
< base::PortInterface * > 
Ports
 A sequence of pointers to ports.
typedef std::vector< std::string > PortNames
 A sequence of names of ports.
typedef boost::function< void(base::PortInterface *) SlotFunction )

Public Member Functions

 Service (const std::string &name, TaskContext *owner=0)
 Creates a Service with a name and an owner.
const std::string & getName () const
 Returns the name of this service instance.
const std::string & doc () const
 Returns a descriptive text for this service.
void doc (const std::string &description)
 Sets the descriptive text for this service.
void setName (const std::string &name)
 Changes the name of this service.
void setOwner (TaskContext *new_owner)
 Sets the owning TaskContext that will execute the operations in this service.
void setParent (shared_ptr new_parent)
 Sets the parent service in case this service is a sub-service.
shared_ptr getParent () const
 The parent is the direct parent of this service.
virtual ProviderNames getProviderNames () const
 Return a standard container which contains all the sub-service names of this Service.
TaskContextgetOwner () const
 The owner is the top-level TaskContext owning this service (indirectly).
ExecutionEnginegetOwnerExecutionEngine () const
 Return the execution engine of this service owner.
virtual bool addService (shared_ptr obj)
 Add a new Service to this TaskContext.
virtual void removeService (std::string const &service_name)
 Remove a previously added sub-service.
Service::shared_ptr provides ()
 Returns this Service.
Service::shared_ptr provides (const std::string &service_name)
 Returns a sub-Service which resorts under this Service.
shared_ptr getService (const std::string &service_name)
 Returns a shared pointer to strictly a sub-service.
bool hasService (const std::string &service_name)
 Check if this service has the sub-service service_name.
void clear ()
 Clear all added operations from the repository, saving memory space.
std::vector< std::string > getOperationNames () const
 Returns the names of all operations added to this interface.
bool hasOperation (const std::string &name) const
 Query for the existence of a Operation in this interface.
bool addLocalOperation (base::OperationBase &op)
 Add an Operation object to the operation interface.
boost::shared_ptr
< base::DisposableInterface
getLocalOperation (std::string name)
 Get a locally added operation from this interface.
OperationInterfacePartgetOperation (std::string name)
 Get a previously added operation for use in a C++ OperationCaller object.
void removeOperation (const std::string &name)
 Removes a previously added operation.
bool setOperationThread (std::string const &name, ExecutionThread et)
 Sets the thread of execution of a previously added operation.
template<class Signature >
Operation< Signature > & addOperation (Operation< Signature > &op)
 Add an operation object to the interface.
template<class Signature >
Operation< Signature > & addSynchronousOperation (Operation< Signature > &op)
 Add an operation object to the interface.
template<class Func , class Service >
Operation< typename
internal::GetSignature< Func >
::Signature > & 
addOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread)
 Add an operation to the interface by means of a C++ function.
template<class Func >
Operation< Func > & addOperation (const std::string name, Func *func, ExecutionThread et=ClientThread)
 Add an operation to the interface by means of a C function.
template<class Func , class Service >
Operation< typename
internal::GetSignature< Func >
::Signature > & 
addSynchronousOperation (const std::string name, Func func, Service *serv, ExecutionThread et=ClientThread)
 Add an operation to the synchronous interface by means of a function.
template<class Func , class ObjT >
Operation< typename
internal::GetSignatureDS< Func >
::Signature > & 
addOperationDS (const std::string &name, Func func, internal::DataSource< boost::shared_ptr< ObjT > > *sp, ExecutionThread et=ClientThread)
 For internal use only.
template<class Signature , class ObjT >
Operation< Signature > & addOperationDS (internal::DataSource< boost::shared_ptr< ObjT > > *sp, Operation< Signature > &op)
 For internal use only.
base::DataSourceBase::shared_ptr getOperation (std::string name, const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const
 For internal use only.
internal::OperationCallerC create (std::string name, ExecutionEngine *caller)
 Create a OperationCallerC object, a template-less operation invocation object.
bool resetOperation (std::string name, base::OperationBase *impl)
 Reset the implementation of a operation.
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.
int getCollectArity (const std::string &name) const
 Query the collectable number of arguments of an operation.
bool isSynchronous (const std::string &name) const
 Query if a given operation is limited to sychronous invocation (own component thread) only.
base::DataSourceBase::shared_ptr produce (const std::string &name, const Arguments &args, ExecutionEngine *caller) const
 Produce a DataSource that call()s an operation.
base::DataSourceBase::shared_ptr produceSend (const std::string &name, const Arguments &args, ExecutionEngine *caller) const
 Produce a DataSource that send()s an operation.
base::DataSourceBase::shared_ptr produceHandle (const std::string &name) const
 Produce an AssignableDataSource that contains a SendHandle, fit for the operation.
base::DataSourceBase::shared_ptr produceCollect (const std::string &name, const Arguments &args, internal::DataSource< bool >::shared_ptr blocking) const
 Produce a DataSource that collects a sent operation, The DataSource will return the SendStatus and store the results in the presented arguments.
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, OperationInterfacePart *part)
 Add a new operation to the interface or replace an existing one.
void remove (const std::string &name)
 Remove an added operation from the interface.
OperationInterfacePartgetPart (const std::string &name)
 Get a previously added part of this factory.
bool hasAttribute (const std::string &name) const
 Check if an attribute is present in this interface.
template<class T >
bool addAttribute (const std::string &name, T &attr)
 Adds a variable of any type as read/write attribute to the configuration interface.
template<class T >
Attribute< T > & addAttribute (const std::string &name, Attribute< T > &attr)
 Adds an existing attribute object to the configuration interface.
bool addAttribute (base::AttributeBase &a)
 Add an base::AttributeBase which remains owned by the user.
template<class T >
bool addConstant (const std::string &name, const T &cnst)
 Adds a variable of any type as read-only attribute to the configuration interface.
template<class T >
Constant< T > & addConstant (const std::string &name, Constant< T > &cnst)
 Adds an existing constant object to the configuration interface.
bool addConstant (base::AttributeBase &c)
 Add a Constant with a given value.
template<class T >
Property< T > & addProperty (const std::string &name, T &prop)
 Adds a variable of any type as a property to the configuration interface.
template<class T >
Property< T > & addProperty (const std::string &name, Property< T > &prop)
 Adds an existing property object to the configuration interface.
bool addProperty (base::PropertyBase &pb)
 Add an base::PropertyBase as a property.
base::AttributeBasegetAttribute (const std::string &name) const
void removeAttribute (const std::string &name)
 Remove an attribute from the repository.
base::AttributeBasegetConstant (const std::string &name) const
bool hasProperty (const std::string &name) const
 Check if a property is present.
bool removeProperty (base::PropertyBase &p)
 Remove a previously added Property and associated attribute.
base::PropertyBasegetProperty (const std::string &name) const
 Get a Property with name name.
bool setValue (base::AttributeBase *ab)
 Transfer the ownership of an attribute to the repository.
base::AttributeBasegetValue (const std::string &name) const
bool removeValue (const std::string &name)
 Delete a value added with setValue from the repository.
ConfigurationInterfacecopy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &repl, bool instantiate) const
 Return a new copy of this repository with the copy operation semantics.
void loadValues (AttributeObjects const &new_values)
 Adds these attributes to this repository.
AttributeObjects const & getValues () const
 Returns all attributes in this repository.
AttributeNames getAttributeNames () const
 Return the names of all attributes in this repository.
PropertyBagproperties ()
 Return a bag of all properties.
base::PortInterfaceaddPort (const std::string &name, base::PortInterface &port)
 Name and add a Port to the interface of this task and add a Service with the same name of the port.
base::PortInterfaceaddPort (base::PortInterface &port)
 Add a Port to the interface of this task and add a Service with the same name of the port.
base::InputPortInterfaceaddEventPort (const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 Name and add an Event triggering Port to the interface of this task and add a Service with the same name of the port.
base::InputPortInterfaceaddEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 Add an Event triggering Port to the interface of this task and add a Service with the same name of the port.
void removePort (const std::string &name)
 Remove a Port from this interface.
Ports getPorts () const
 Get all ports of this interface.
PortNames getPortNames () const
 Get all port names of this interface.
base::PortInterfacegetPort (const std::string &name) const
 Get an added port.
std::string getPortDescription (const std::string &name) const
 Get the description of an added Port.
bool setPortDescription (const std::string &name, const std::string description)
 Sets the description for the service of an added port.
ServicegetService () const
 Returns the service this interface belongs to.
base::PortInterfaceaddLocalPort (base::PortInterface &port)
 Add a Port to this task without registering a service for it.
base::InputPortInterfaceaddLocalEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction())
 Add an Event triggering Port to this task without registering a service for it.
template<class Type >
Type * getPortType (const std::string &name)
 Get a port of a specific type.
void dataOnPort (base::PortInterface *port)
 Used by the input ports to notify this class of new data.

Static Public Member Functions

static Service::shared_ptr Create (const std::string &name, TaskContext *owner=0)
 Creates a Service with a name and an owner.

Protected Types

typedef std::map< std::string,
shared_ptr > 
Services
typedef std::map< std::string,
base::OperationBase * > 
SimpleOperations
typedef std::vector
< base::OperationBase * > 
OperationList
typedef std::map< std::string,
OperationInterfacePart * > 
map_t
typedef std::vector
< base::AttributeBase * > 
map_t

Protected Member Functions

bool testOperation (base::OperationBase &op)
bool chkPtr (const std::string &where, const std::string &name, const void *ptr)
ServicecreatePortObject (const std::string &name)
 Create a Service through which one can access a Port.
bool chkPtr (const std::string &where, const std::string &name, const void *ptr)

Protected Attributes

Services services
 the services we implement.
SimpleOperations simpleoperations
OperationList ownedoperations
std::string mname
std::string mdescription
TaskContextmowner
shared_ptr parent
map_t data
map_t values
PropertyBag bag
Ports mports
 All our ports.
Servicemservice
 The parent Service.

Detailed Description

This class allows storage and retrieval of operations, attributes and properties provided by a component.

Services can be nested in sub-services, although this is rare.

Definition at line 81 of file Service.hpp.


Constructor & Destructor Documentation

RTT::Service::Service ( const std::string &  name,
TaskContext owner = 0 
)

Creates a Service with a name and an owner.

Each service must be owned by a TaskContext and the owner can be set afterwards with setOwner.

Parameters:
nameThe name of this service.
ownerThe TaskContext that will execute the operations of this service.
Warning:
When using boost < 1.40, the owner is not stored in the Service, until the Service object is effectively added to the TaskContext.
See also:
getOwner()

Definition at line 59 of file Service.cpp.

References RTT::DataFlowInterface::mservice.


Member Function Documentation

void OperationInterface::add ( const std::string &  name,
OperationInterfacePart part 
) [inherited]

Add a new operation to the interface or replace an existing one.

Parameters:
nameThe name of the operation
partA part which creates the operation.

Definition at line 170 of file OperationInterface.cpp.

template<class T >
bool RTT::ConfigurationInterface::addAttribute ( const std::string &  name,
T &  attr 
) [inline, inherited]

Adds a variable of any type as read/write attribute to the configuration interface.

An Alias is created which causes contents of the attr variable always to be in sync with the contents of the attribute object in the interface.

Parameters:
nameThe name of this attribute
attrThe variable that will be aliased.

Definition at line 101 of file ConfigurationInterface.hpp.

template<class T >
Attribute<T>& RTT::ConfigurationInterface::addAttribute ( const std::string &  name,
Attribute< T > &  attr 
) [inline, inherited]

Adds an existing attribute object to the configuration interface.

Parameters:
nameThe name of this attribute. attr will be initialized with this name.
attrThe attribute to add
Returns:
the Attribute object by reference, which you can further query or use.
Postcondition:
attr.ready() == true

Definition at line 115 of file ConfigurationInterface.hpp.

References RTT::base::AttributeBase::ready(), and RTT::base::AttributeBase::setName().

Add an base::AttributeBase which remains owned by the user.

This is a low-level function that can be used if you already created an Attribute object that does not belong yet to a service.

Parameters:
aremains owned by the user, and becomes served by the repository.

Definition at line 204 of file ConfigurationInterface.hpp.

References RTT::base::AttributeBase::clone(), and RTT::base::AttributeBase::getDataSource().

template<class T >
bool RTT::ConfigurationInterface::addConstant ( const std::string &  name,
const T &  cnst 
) [inline, inherited]

Adds a variable of any type as read-only attribute to the configuration interface.

An Alias is created which causes contents of the attribute always to be in sync with the contents of cnst, but it can only be read through the interface.

Parameters:
nameThe name of this attribute
cnstThe variable that will be aliased.

Definition at line 135 of file ConfigurationInterface.hpp.

template<class T >
Constant<T>& RTT::ConfigurationInterface::addConstant ( const std::string &  name,
Constant< T > &  cnst 
) [inline, inherited]

Adds an existing constant object to the configuration interface.

Parameters:
nameThe name of this constant. cnst will be initialized with this name.
cnstThe constant to add. If cnst has not been initialized, it will be initialized to T(). You can change it later-on using the Constant's API.
Returns:
the Constant object by reference, which you can further query or use.
Postcondition:
cnst.ready() == true

Definition at line 150 of file ConfigurationInterface.hpp.

References RTT::base::AttributeBase::ready(), and RTT::base::AttributeBase::setName().

Add a Constant with a given value.

See also:
getConstant

Definition at line 232 of file ConfigurationInterface.hpp.

References RTT::base::AttributeBase::clone(), and RTT::base::AttributeBase::getDataSource().

base::InputPortInterface& RTT::DataFlowInterface::addEventPort ( const std::string &  name,
base::InputPortInterface port,
SlotFunction  callback = SlotFunction() 
) [inline, inherited]

Name and add an Event triggering Port to the interface of this task and add a Service with the same name of the port.

Parameters:
nameThe name to give to the port.
portThe port to add.
callback(Optional) provide a function which will be called asynchronously when new data arrives on this port. You can add more functions by using the port directly using base::PortInterface::getNewDataOnPort().

Definition at line 114 of file DataFlowInterface.hpp.

References RTT::base::PortInterface::setName().

InputPortInterface & RTT::DataFlowInterface::addEventPort ( base::InputPortInterface port,
SlotFunction  callback = SlotFunction() 
) [inherited]

Add an Event triggering Port to the interface of this task and add a Service with the same name of the port.

When data arrives on this port your TaskContext will be woken up and updateHook will be executed.

Parameters:
portThe port to add.
callback(Optional) provide a function which will be called when new data arrives on this port. The callback function will be called in sequence with updateHook(), so asynchronously with regard to the arrival of data on the port.
Returns:
port

Definition at line 93 of file DataFlowInterface.cpp.

References RTT::DataFlowInterface::addLocalEventPort(), addService(), RTT::DataFlowInterface::createPortObject(), RTT::base::PortInterface::getName(), hasService(), RTT::DataFlowInterface::mservice, and removeService().

InputPortInterface & RTT::DataFlowInterface::addLocalEventPort ( base::InputPortInterface port,
SlotFunction  callback = SlotFunction() 
) [inherited]

Add an Event triggering Port to this task without registering a service for it.

When data arrives on this port your TaskContext will be woken up and updateHook will be executed.

Parameters:
portThe port to add.
callback(Optional) provide a function which will be called when new data arrives on this port. The callback function will be called in sequence with updateHook(), so asynchronously with regard to the arrival of data on the port.
Returns:
port

Definition at line 127 of file DataFlowInterface.cpp.

References RTT::DataFlowInterface::addLocalPort(), RTT::base::PortInterface::getName(), getName(), getOwner(), RTT::DataFlowInterface::mservice, and RTT::base::InputPortInterface::signalInterface().

Referenced by RTT::DataFlowInterface::addEventPort().

Add an Operation object to the operation interface.

This version of addOperation does not add the Operation object to the remote interface and only to the local, in-process C++ interface.

Note:
Do not use this function unless you know what you're doing.
See also:
addOperation() for adding normal, remotely available operations.
Parameters:
opThe Operation object to add
Returns:
true if it could be added, false otherwise.

Definition at line 177 of file Service.cpp.

References RTT::base::TaskCore::engine(), RTT::base::OperationBase::getImplementation(), RTT::base::OperationBase::getName(), removeOperation(), and RTT::base::OperationBase::setOwner().

Add a Port to this task without registering a service for it.

If a port with the same name already exists, addPort will replace it with port and log a warning.

Returns:
port

Definition at line 78 of file DataFlowInterface.cpp.

References RTT::base::PortInterface::getName(), RTT::DataFlowInterface::mports, RTT::DataFlowInterface::removePort(), and RTT::base::PortInterface::setInterface().

Referenced by RTT::DataFlowInterface::addLocalEventPort(), and RTT::DataFlowInterface::addPort().

template<class Signature >
Operation<Signature>& RTT::Service::addOperation ( Operation< Signature > &  op) [inline]

Add an operation object to the interface.

This version of addOperation exports an existing Operation object to the public interface of this component.

Parameters:
opThe operation object to add.
Returns:
The given parameter op

Definition at line 303 of file Service.hpp.

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

Referenced by RTT::marsh::MarshallingService::MarshallingService().

template<class Func , class Service >
Operation< typename internal::GetSignature<Func>::Signature >& RTT::Service::addOperation ( const std::string  name,
Func  func,
Service serv,
ExecutionThread  et = ClientThread 
) [inline]

Add an operation to the interface by means of a C++ function.

The function func must be a C++ member function and serv is the object having that function.

Parameters:
nameThe name of the new operation
funcA pointer to a function, for example, &Bar::foo (C++ class function).
servA pointer to the object that will execute the function.
etThe ExecutionThread choice: will the owning TaskContext of this service execute the function func in its own thread, or will the client's thread (the caller) execute func ?
Returns:
A newly created operation object, which you may further document or query.

Definition at line 343 of file Service.hpp.

template<class Func >
Operation< Func >& RTT::Service::addOperation ( const std::string  name,
Func *  func,
ExecutionThread  et = ClientThread 
) [inline]

Add an operation to the interface by means of a C function.

The function func must be a C function.

Parameters:
nameThe name of the new operation
funcA pointer to a C function, for example, &foo (or a static C++ class function).
etThe ExecutionThread choice: will the owning TaskContext of this service execute the function func in its own thread, or will the client's thread (the caller) execute func ?
Returns:
A newly created operation object, which you may further document or query.

Definition at line 364 of file Service.hpp.

template<class Func , class ObjT >
Operation< typename internal::GetSignatureDS<Func>::Signature>& RTT::Service::addOperationDS ( const std::string &  name,
Func  func,
internal::DataSource< boost::shared_ptr< ObjT > > *  sp,
ExecutionThread  et = ClientThread 
) [inline]

For internal use only.

The pointer of the object of which a member function must be invoked is stored in a internal::DataSource such that the pointer can change during program execution. Required in scripting for state machines.

Definition at line 401 of file Service.hpp.

Referenced by RTT::scripting::ProgramService::ProgramService().

template<class Signature , class ObjT >
Operation<Signature>& RTT::Service::addOperationDS ( internal::DataSource< boost::shared_ptr< ObjT > > *  sp,
Operation< Signature > &  op 
) [inline]

For internal use only.

The pointer of the object of which a member function must be invoked is stored in a internal::DataSource such that the pointer can change during program execution. Required in scripting for state machines.

Definition at line 416 of file Service.hpp.

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

base::PortInterface& RTT::DataFlowInterface::addPort ( const std::string &  name,
base::PortInterface port 
) [inline, inherited]

Name and add a Port to the interface of this task and add a Service with the same name of the port.

Parameters:
nameThe name to give to the port.
portThe port to add.

Definition at line 89 of file DataFlowInterface.hpp.

References RTT::base::PortInterface::setName().

Add a Port to the interface of this task and add a Service with the same name of the port.

If a port or service with the name already exists, addPort will replace them with port and log a warning.

Parameters:
portThe port to add.
Returns:
port

Definition at line 59 of file DataFlowInterface.cpp.

References RTT::DataFlowInterface::addLocalPort(), addService(), RTT::DataFlowInterface::createPortObject(), RTT::base::PortInterface::getName(), hasService(), RTT::DataFlowInterface::mservice, and removeService().

template<class T >
Property<T>& RTT::ConfigurationInterface::addProperty ( const std::string &  name,
T &  prop 
) [inline, inherited]

Adds a variable of any type as a property to the configuration interface.

A Property is created which causes contents of the property always to be in sync with the contents of prop.

Parameters:
nameThe name of this property
propThe variable that will be aliased.
Returns:
the Property object by reference, which you can further query or document.

Definition at line 171 of file ConfigurationInterface.hpp.

Referenced by RTT::scripting::ScriptingService::ScriptingService().

template<class T >
Property<T>& RTT::ConfigurationInterface::addProperty ( const std::string &  name,
Property< T > &  prop 
) [inline, inherited]

Adds an existing property object to the configuration interface.

Parameters:
nameThe name of this property. prop will be initialized with this name.
propThe property to add
Returns:
the Property object by reference, which you can further query or document.
Postcondition:
prop.ready() == true

Definition at line 184 of file ConfigurationInterface.hpp.

References RTT::base::PropertyBase::ready(), and RTT::base::PropertyBase::setName().

Add an base::PropertyBase as a property.

Returns:
false if a property with the same name already exists.
See also:
removeProperty

Definition at line 90 of file ConfigurationInterface.cpp.

References RTT::base::PropertyBase::getName().

bool RTT::Service::addService ( Service::shared_ptr  obj) [virtual]

Add a new Service to this TaskContext.

Parameters:
objThis object becomes owned by this TaskContext.
Returns:
true if it could be added, false if such service already exists.

Definition at line 87 of file Service.cpp.

References services.

Referenced by RTT::DataFlowInterface::addEventPort(), and RTT::DataFlowInterface::addPort().

template<class Signature >
Operation<Signature>& RTT::Service::addSynchronousOperation ( Operation< Signature > &  op) [inline]

Add an operation object to the interface.

This version exports an existing Operation object to the synchronous interface of the component

Parameters:
opThe operation object to add.
Returns:
The given parameter op

Definition at line 320 of file Service.hpp.

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

Referenced by RTT::base::PortInterface::createPortObject().

template<class Func , class Service >
Operation< typename internal::GetSignature<Func>::Signature >& RTT::Service::addSynchronousOperation ( const std::string  name,
Func  func,
Service serv,
ExecutionThread  et = ClientThread 
) [inline]

Add an operation to the synchronous interface by means of a function.

The function func must be a C++ function.

Parameters:
nameThe name of the new operation
funcA pointer to a function, for example &Bar::foo (C++ class function).
servA pointer to the object that will execute the function in case of a C++ class function,
etThe ExecutionThread choice: will the owning TaskContext of this service execute the function func in its own thread, or will the client's thread (the caller) execute func ?
Returns:
A newly created operation object, which you may further document or query.

Definition at line 387 of file Service.hpp.

ConfigurationInterface * RTT::ConfigurationInterface::copy ( std::map< const base::DataSourceBase *, base::DataSourceBase * > &  repl,
bool  instantiate 
) const [inherited]

Return a new copy of this repository with the copy operation semantics.

Parameters:
instantiateset to true if you want a copy which will upon any future copy return the same DataSources, thus 'fixating' or 'instantiating' the DataSources.
See also:
base::ActionInterface
Note:
this does not copy the properties() within this repository.

Definition at line 60 of file ConfigurationInterface.cpp.

References RTT::ConfigurationInterface::setValue().

Referenced by RTT::scripting::ScriptingService::loadFunctions(), RTT::scripting::ScriptingService::loadPrograms(), RTT::scripting::ScriptingService::loadStateMachines(), and RTT::scripting::ScriptingService::runScript().

Service::shared_ptr RTT::Service::Create ( const std::string &  name,
TaskContext owner = 0 
) [static]

Creates a Service with a name and an owner.

Each service must be owned by a TaskContext and the owner can be set afterwards with setOwner.

Parameters:
nameThe name of this service.
ownerThe TaskContext that will execute the operations of this service.
Warning:
When using boost < 1.40, the owner is not stored in the Service, until the Service object is effectively added to the TaskContext.
See also:
getOwner()

Definition at line 52 of file Service.cpp.

References RTT::TaskContext::provides().

internal::OperationCallerC RTT::Service::create ( std::string  name,
ExecutionEngine caller 
)

Create a OperationCallerC object, a template-less operation invocation object.

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

Parameters:
nameThe name of the operation
Returns:
An object which can invoke a operation.

Definition at line 265 of file Service.cpp.

References RTT::OperationInterface::getPart().

Service * RTT::DataFlowInterface::createPortObject ( const std::string &  name) [protected, inherited]

Create a Service through which one can access a Port.

Parameters:
nameThe port name

Definition at line 211 of file DataFlowInterface.cpp.

References RTT::base::PortInterface::createPortObject(), doc(), RTT::DataFlowInterface::getPort(), and RTT::DataFlowInterface::getPortDescription().

Referenced by RTT::DataFlowInterface::addEventPort(), and RTT::DataFlowInterface::addPort().

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

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

Parameters:
nameThe name of the operation
Returns:
A list of descriptions.
Exceptions:
name_not_found_exception

Definition at line 146 of file OperationInterface.cpp.

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

Query the number of arguments of an operation.

These are the number of function arguments, not counting the return value.

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

Definition at line 77 of file OperationInterface.cpp.

int OperationInterface::getCollectArity ( const std::string &  name) const [inherited]

Query the collectable number of arguments of an operation.

These are the return value (if non void) and each non-const reference argument of the operation.

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

Definition at line 85 of file OperationInterface.cpp.

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

Get the description of an operation.

Parameters:
nameThe name of the operation
Returns:
A user readable description.
Exceptions:
name_not_found_exception

Definition at line 162 of file OperationInterface.cpp.

boost::shared_ptr< base::DisposableInterface > RTT::Service::getLocalOperation ( std::string  name)

Get a locally added operation from this interface.

Note:
Do not use this function unless you know what you're doing.
See also:
getOperation() for getting normal, remotely available operations.

Definition at line 200 of file Service.cpp.

References hasOperation().

Get a previously added operation for use in a C++ OperationCaller object.

Store the result of this function in a OperationCaller<Signature> object.

Parameters:
nameThe name of the operation to retrieve.
Returns:
A pointer to an operation interface part or a null pointer if name was not found.

Definition at line 141 of file Service.cpp.

References getName(), RTT::OperationInterface::getPart(), and RTT::OperationInterface::hasMember().

Referenced by setOperationThread().

base::DataSourceBase::shared_ptr RTT::Service::getOperation ( std::string  name,
const std::vector< base::DataSourceBase::shared_ptr > &  args,
ExecutionEngine caller 
) const [inline]

For internal use only.

Get a previously added operation as a DataSource. This function is inferior to getOperation(std::string name)

Parameters:
nameThe name of the operation
argsThe arguments of the operation as Data Sources.
Returns:
A internal::DataSource which, when evaluated, invokes the operation.

Definition at line 435 of file Service.hpp.

std::vector< std::string > RTT::Service::getOperationNames ( ) const

Returns the names of all operations added to this interface.

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

Definition at line 224 of file Service.cpp.

TaskContext* RTT::Service::getOwner ( ) const [inline]

The owner is the top-level TaskContext owning this service (indirectly).

A Service can only belong to one TaskContext.

Note:
This function will only return the owner after the Service has been added to the TaskContext.

Reimplemented from RTT::DataFlowInterface.

Definition at line 171 of file Service.hpp.

Referenced by RTT::DataFlowInterface::addLocalEventPort(), RTT::DataFlowInterface::dataOnPort(), RTT::DataFlowInterface::getOwner(), getOwnerExecutionEngine(), RTT::scripting::ScriptingService::loadProgram(), RTT::scripting::ScriptingService::loadStateMachine(), RTT::DataFlowInterface::removePort(), and setOperationThread().

Return the execution engine of this service owner.

See also:
getOwner

Definition at line 81 of file Service.cpp.

References RTT::base::TaskCore::engine(), and getOwner().

OperationInterfacePart * OperationInterface::getPart ( const std::string &  name) [inherited]

Get a previously added part of this factory.

Parameters:
name
Returns:

Definition at line 188 of file OperationInterface.cpp.

Referenced by create(), and getOperation().

PortInterface * RTT::DataFlowInterface::getPort ( const std::string &  name) const [inherited]

Get an added port.

Parameters:
nameThe port name
Returns:
a pointer to a port or null if it does not exist.

Definition at line 184 of file DataFlowInterface.cpp.

References RTT::DataFlowInterface::mports.

Referenced by RTT::TaskContext::connectPorts(), and RTT::DataFlowInterface::createPortObject().

std::string RTT::DataFlowInterface::getPortDescription ( const std::string &  name) const [inherited]

Get the description of an added Port.

Parameters:
nameThe port name
Returns:
The description or "" if it does not exist.

Definition at line 193 of file DataFlowInterface.cpp.

References RTT::DataFlowInterface::mports.

Referenced by RTT::DataFlowInterface::createPortObject().

Get all port names of this interface.

Returns:
A sequence of strings containing the port names.
Deprecated:
by getNames()

Definition at line 175 of file DataFlowInterface.cpp.

References RTT::DataFlowInterface::mports.

Get all ports of this interface.

Returns:
A sequence of pointers to ports.

Definition at line 171 of file DataFlowInterface.cpp.

References RTT::DataFlowInterface::mports.

Referenced by RTT::TaskContext::connectPorts(), and RTT::TaskContext::disconnect().

base::PropertyBase* RTT::ConfigurationInterface::getProperty ( const std::string &  name) const [inline, inherited]

Get a Property with name name.

Parameters:
nameThe name of the property to search for.
Returns:
The PropertyBase with this name, zero if it does not exist.

Definition at line 275 of file ConfigurationInterface.hpp.

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

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

Parameters:
nameThe name of the operation
Returns:
A name of a data type.
Exceptions:
name_not_found_exception

Definition at line 154 of file OperationInterface.cpp.

Service* RTT::DataFlowInterface::getService ( ) const [inline, inherited]

Returns the service this interface belongs to.

The returned service is a service living in the component returned by getOwner() or in one of its sub-services.

Definition at line 193 of file DataFlowInterface.hpp.

Service::shared_ptr RTT::Service::getService ( const std::string &  service_name)

Returns a shared pointer to strictly a sub-service.

This method will not return the this pointer when service_name equals "this".

Definition at line 134 of file Service.cpp.

References services.

Referenced by RTT::DataFlowInterface::setPortDescription().

bool RTT::Service::hasOperation ( const std::string &  name) const

Query for the existence of a Operation in this interface.

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

Definition at line 230 of file Service.cpp.

Referenced by getLocalOperation(), removeOperation(), resetOperation(), and setOperationThread().

bool OperationInterface::isSynchronous ( const std::string &  name) const [inherited]

Query if a given operation is limited to sychronous invocation (own component thread) only.

Returns:
false if name not found or a normal operation, true if name exists but is synchronous.

Definition at line 93 of file OperationInterface.cpp.

base::DataSourceBase::shared_ptr OperationInterface::produce ( const std::string &  name,
const Arguments args,
ExecutionEngine caller 
) const [inherited]

Produce a DataSource that call()s an operation.

The DataSource will return the result of call().

Parameters:
nameThe name of the operation
argsThe arguments filled in as data sources.
Returns:
a new object
Exceptions:
wrong_number_of_args_exception
wrong_types_of_args_exception
name_not_found_exception

Definition at line 105 of file OperationInterface.cpp.

base::DataSourceBase::shared_ptr OperationInterface::produceCollect ( const std::string &  name,
const Arguments args,
internal::DataSource< bool >::shared_ptr  blocking 
) const [inherited]

Produce a DataSource that collects a sent operation, The DataSource will return the SendStatus and store the results in the presented arguments.

Note that this function takes most of the time less arguments than its companions.

Parameters:
nameThe name of the operation
argsThe arguments filled in as data sources.
blockingSet to true to block on the result.
Returns:
a new object
Exceptions:
wrong_number_of_args_exception
wrong_types_of_args_exception
name_not_found_exception
no_asynchronous_operation_exception

Definition at line 129 of file OperationInterface.cpp.

base::DataSourceBase::shared_ptr OperationInterface::produceHandle ( const std::string &  name) const [inherited]

Produce an AssignableDataSource that contains a SendHandle, fit for the operation.

The DataSource will return the SendHandle.

Parameters:
nameThe name of the operation
argsThe arguments filled in as data sources.
Returns:
a new object
Exceptions:
wrong_number_of_args_exception
wrong_types_of_args_exception
name_not_found_exception
no_asynchronous_operation_exception

Definition at line 121 of file OperationInterface.cpp.

base::DataSourceBase::shared_ptr OperationInterface::produceSend ( const std::string &  name,
const Arguments args,
ExecutionEngine caller 
) const [inherited]

Produce a DataSource that send()s an operation.

The DataSource will return the SendHandle of that operation.

Parameters:
nameThe name of the operation
argsThe arguments filled in as data sources.
Returns:
a new object
Exceptions:
wrong_number_of_args_exception
wrong_types_of_args_exception
name_not_found_exception
no_asynchronous_operation_exception

Definition at line 113 of file OperationInterface.cpp.

Service::shared_ptr RTT::Service::provides ( )

Returns this Service.

Returns:
a shared pointer from this.

Definition at line 111 of file Service.cpp.

Referenced by provides().

Service::shared_ptr RTT::Service::provides ( const std::string &  service_name)

Returns a sub-Service which resorts under this Service.

Parameters:
service_nameThe name of the sub-service.

Definition at line 121 of file Service.cpp.

References provides(), and services.

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

Remove an added operation from the interface.

Parameters:
nameThe name of the operation

Definition at line 178 of file OperationInterface.cpp.

Referenced by removeOperation().

void RTT::DataFlowInterface::removePort ( const std::string &  name) [inherited]

Remove a Port from this interface.

This will remove all connections and callbacks assosiated with this port.

Parameters:
portThe port to remove.

Definition at line 155 of file DataFlowInterface.cpp.

References getOwner(), RTT::DataFlowInterface::mports, RTT::DataFlowInterface::mservice, and removeService().

Referenced by RTT::DataFlowInterface::addLocalPort().

Remove a previously added Property and associated attribute.

Returns:
false if no such property exists.

Definition at line 129 of file ConfigurationInterface.cpp.

References RTT::base::PropertyBase::getName().

void RTT::Service::removeService ( std::string const &  service_name) [virtual]

Remove a previously added sub-service.

Parameters:
thename of the service to remove.

Definition at line 102 of file Service.cpp.

References services.

Referenced by RTT::DataFlowInterface::addEventPort(), RTT::DataFlowInterface::addPort(), clear(), RTT::DataFlowInterface::clear(), and RTT::DataFlowInterface::removePort().

bool RTT::Service::setOperationThread ( std::string const &  name,
ExecutionThread  et 
)

Sets the thread of execution of a previously added operation.

Only the component itself should modify this property. Don't call this function from outside the component, it has unspecified behaviour when not called from within one of the member functions or a service of the current component.

This function is typically used to change the ExecutionThread of the standard component hooks such as startHook(), configureHook() etc. which all have the ClientThread policy by default.

Parameters:
nameThe name of the operation to modify. For example, "start".
etThe ExecutionThread type in which the function of the operation will be executed, being OwnThread or ClientThread.
Returns:
true if name was a local, present operation, false otherwise.

Definition at line 159 of file Service.cpp.

References RTT::OperationInterfacePart::getLocalOperation(), getOperation(), getOwner(), hasOperation(), and RTT::base::OperationCallerInterface::setThread().

bool RTT::DataFlowInterface::setPortDescription ( const std::string &  name,
const std::string  description 
) [inherited]

Sets the description for the service of an added port.

It's prefered to use getPort(name)->doc(description) instead of this method, since this function only updates the documentation of the service representing this port, and not the documentation stored in the port.

Parameters:
nameThe port name
descriptionThe new description for this port's service
Returns:
true if the port was found and the description was set, false otherwise.

Definition at line 202 of file DataFlowInterface.cpp.

References getService(), and RTT::DataFlowInterface::mservice.

Referenced by RTT::base::PortInterface::doc().

Transfer the ownership of an attribute to the repository.

Parameters:
abThe attribute which becomes owned by this repository.
Returns:
false if an Attribute with the same name already present.

Definition at line 78 of file ConfigurationInterface.cpp.

References RTT::base::AttributeBase::getDataSource(), and RTT::base::AttributeBase::getName().

Referenced by RTT::ConfigurationInterface::copy().


Member Data Documentation

Service* RTT::DataFlowInterface::mservice [protected, inherited]

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