#include <Service.hpp>
Public Types | |
typedef OperationInterface | Factory |
typedef std::vector< std::string > | ProviderNames |
typedef boost::shared_ptr< const Service > | shared_constptr |
typedef boost::shared_ptr< Service > | shared_ptr |
Public Types inherited from RTT::OperationInterface | |
typedef std::vector< base::DataSourceBase::shared_ptr > | Arguments |
typedef std::vector< ArgumentDescription > | Descriptions |
Public Types inherited from RTT::ConfigurationInterface | |
typedef std::vector< std::string > | AttributeNames |
typedef std::vector< base::AttributeBase * > | AttributeObjects |
Public Types inherited from RTT::DataFlowInterface | |
typedef std::vector< std::string > | PortNames |
typedef std::vector< base::PortInterface * > | Ports |
typedef boost::function< void(base::PortInterface *)> | SlotFunction |
Public Member Functions | |
bool | addLocalOperation (base::OperationBase &op) |
template<class Signature > | |
Operation< Signature > & | addOperation (Operation< Signature > &op) |
template<class Func , class Class > | |
Operation< typename internal::GetSignature< Func >::Signature > & | addOperation (const std::string name, Func func, Class *obj, ExecutionThread et=ClientThread) |
template<class Func > | |
Operation< Func > & | addOperation (const std::string name, Func *func, ExecutionThread et=ClientThread) |
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) |
template<class Signature , class ObjT > | |
Operation< Signature > & | addOperationDS (internal::DataSource< boost::shared_ptr< ObjT > > *sp, Operation< Signature > &op) |
virtual bool | addService (shared_ptr obj) |
template<class Signature > | |
Operation< Signature > & | addSynchronousOperation (Operation< Signature > &op) |
template<class Func , class Class > | |
Operation< typename internal::GetSignature< Func >::Signature > & | addSynchronousOperation (const std::string name, Func func, Class *obj, ExecutionThread et=ClientThread) |
void | clear () |
internal::OperationCallerC | create (std::string name, ExecutionEngine *caller) |
const std::string & | doc () const |
void | doc (const std::string &description) |
boost::shared_ptr< base::DisposableInterface > | getLocalOperation (std::string name) |
const std::string & | getName () const |
OperationInterfacePart * | getOperation (std::string name) |
base::DataSourceBase::shared_ptr | getOperation (std::string name, const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const |
std::vector< std::string > | getOperationNames () const |
TaskContext * | getOwner () const |
ExecutionEngine * | getOwnerExecutionEngine () const |
shared_ptr | getParent () const |
virtual ProviderNames | getProviderNames () const |
shared_ptr | getService (const std::string &service_name) |
bool | hasOperation (const std::string &name) const |
bool | hasService (const std::string &service_name) |
Service::shared_ptr | provides () |
Service::shared_ptr | provides (const std::string &service_name) |
void | removeOperation (const std::string &name) |
virtual void | removeService (std::string const &service_name) |
bool | resetOperation (std::string name, base::OperationBase *impl) |
Service (const std::string &name, TaskContext *owner=0) | |
void | setName (const std::string &name) |
bool | setOperationThread (std::string const &name, ExecutionThread et) |
void | setOwner (TaskContext *new_owner) |
void | setParent (shared_ptr new_parent) |
virtual | ~Service () |
Public Member Functions inherited from RTT::OperationInterface | |
void | add (const std::string &name, OperationInterfacePart *part) |
void | clear () |
Descriptions | getArgumentList (const std::string &name) const |
int | getArity (const std::string &name) const |
int | getCollectArity (const std::string &name) const |
std::string | getDescription (const std::string &name) const |
std::vector< std::string > | getNames () const |
OperationInterfacePart * | getPart (const std::string &name) |
std::string | getResultType (const std::string &name) const |
bool | hasMember (const std::string &name) const |
bool | isSynchronous (const std::string &name) const |
base::DataSourceBase::shared_ptr | produce (const std::string &name, const Arguments &args, ExecutionEngine *caller) const |
base::DataSourceBase::shared_ptr | produceCollect (const std::string &name, const Arguments &args, internal::DataSource< bool >::shared_ptr blocking) const |
base::DataSourceBase::shared_ptr | produceHandle (const std::string &name) const |
base::DataSourceBase::shared_ptr | produceSend (const std::string &name, const Arguments &args, ExecutionEngine *caller) const |
void | remove (const std::string &name) |
Public Member Functions inherited from RTT::ConfigurationInterface | |
template<class T > | |
bool | addAttribute (const std::string &name, T &attr) |
template<class T > | |
Attribute< T > & | addAttribute (const std::string &name, Attribute< T > &attr) |
bool | addAttribute (base::AttributeBase &a) |
template<class T > | |
bool | addConstant (const std::string &name, const T &cnst) |
template<class T > | |
Constant< T > & | addConstant (const std::string &name, Constant< T > &cnst) |
bool | addConstant (base::AttributeBase &c) |
template<class T > | |
Property< T > & | addProperty (const std::string &name, T &prop) |
template<class T > | |
Property< T > & | addProperty (const std::string &name, Property< T > &prop) |
bool | addProperty (base::PropertyBase &pb) |
void | clear () |
ConfigurationInterface () | |
ConfigurationInterface * | copy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &repl, bool instantiate) const |
base::AttributeBase * | getAttribute (const std::string &name) const |
AttributeNames | getAttributeNames () const |
base::AttributeBase * | getConstant (const std::string &name) const |
base::PropertyBase * | getProperty (const std::string &name) const |
base::AttributeBase * | getValue (const std::string &name) const |
AttributeObjects const & | getValues () const |
bool | hasAttribute (const std::string &name) const |
bool | hasProperty (const std::string &name) const |
void | loadValues (AttributeObjects const &new_values) |
PropertyBag * | properties () |
void | removeAttribute (const std::string &name) |
bool | removeProperty (base::PropertyBase &p) |
bool | removeValue (const std::string &name) |
bool | setValue (base::AttributeBase *ab) |
~ConfigurationInterface () | |
Public Member Functions inherited from RTT::DataFlowInterface | |
base::InputPortInterface & | addEventPort (const std::string &name, base::InputPortInterface &port, SlotFunction callback=SlotFunction()) |
base::InputPortInterface & | addEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction()) |
base::InputPortInterface & | addLocalEventPort (base::InputPortInterface &port, SlotFunction callback=SlotFunction()) |
base::PortInterface & | addLocalPort (base::PortInterface &port) |
base::PortInterface & | addPort (const std::string &name, base::PortInterface &port) |
base::PortInterface & | addPort (base::PortInterface &port) |
void | clear () |
DataFlowInterface (Service *parent=0) | |
void | dataOnPort (base::PortInterface *port) |
TaskContext * | getOwner () const |
base::PortInterface * | getPort (const std::string &name) const |
std::string | getPortDescription (const std::string &name) const |
PortNames | getPortNames () const |
Ports | getPorts () const |
template<class Type > | |
Type * | getPortType (const std::string &name) |
Service * | getService () const |
void | removeLocalPort (const std::string &name) |
void | removePort (const std::string &name) |
bool | setPortDescription (const std::string &name, const std::string description) |
~DataFlowInterface () | |
Static Public Member Functions | |
static Service::shared_ptr | Create (const std::string &name, TaskContext *owner=0) |
Protected Types | |
typedef std::vector< base::OperationBase * > | OperationList |
typedef std::map< std::string, shared_ptr > | Services |
typedef std::map< std::string, base::OperationBase * > | SimpleOperations |
Protected Types inherited from RTT::OperationInterface | |
typedef std::map< std::string, OperationInterfacePart * > | map_t |
Protected Types inherited from RTT::ConfigurationInterface | |
typedef std::vector< base::AttributeBase * > | map_t |
Protected Member Functions | |
bool | testOperation (base::OperationBase &op) |
Protected Member Functions inherited from RTT::ConfigurationInterface | |
bool | chkPtr (const std::string &where, const std::string &name, const void *ptr) |
Protected Member Functions inherited from RTT::DataFlowInterface | |
bool | chkPtr (const std::string &where, const std::string &name, const void *ptr) |
Service * | createPortObject (const std::string &name) |
Protected Attributes | |
std::string | mdescription |
std::string | mname |
TaskContext * | mowner |
OperationList | ownedoperations |
shared_ptr | parent |
Services | services |
the services we implement. More... | |
SimpleOperations | simpleoperations |
Protected Attributes inherited from RTT::OperationInterface | |
map_t | data |
Protected Attributes inherited from RTT::ConfigurationInterface | |
PropertyBag | bag |
map_t | values |
Protected Attributes inherited from RTT::DataFlowInterface | |
Ports | mports |
Service * | mservice |
This class allows storage and retrieval of operations, ports, attributes and properties provided by a component.
Services can be nested in sub-services, but all sub-services will be owned by the same TaskContext.
Definition at line 93 of file Service.hpp.
Definition at line 100 of file Service.hpp.
|
protected |
Definition at line 567 of file Service.hpp.
typedef std::vector<std::string> RTT::Service::ProviderNames |
Definition at line 103 of file Service.hpp.
|
protected |
Definition at line 561 of file Service.hpp.
typedef boost::shared_ptr<const Service> RTT::Service::shared_constptr |
Definition at line 102 of file Service.hpp.
typedef boost::shared_ptr<Service> RTT::Service::shared_ptr |
Definition at line 101 of file Service.hpp.
|
protected |
Definition at line 566 of file Service.hpp.
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.
name | The name of this service. |
owner | The TaskContext that will execute the operations of this service. |
Definition at line 57 of file Service.cpp.
|
virtual |
Definition at line 66 of file Service.cpp.
bool RTT::Service::addLocalOperation | ( | base::OperationBase & | op | ) |
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.
op | The Operation object to add |
Definition at line 178 of file Service.cpp.
|
inline |
Add an operation object to the interface. This version of addOperation exports an existing Operation object to the public interface of this component.
op | The operation object to add. |
Definition at line 341 of file Service.hpp.
|
inline |
Add an operation to the interface by means of a C++ Class member function. The function func must be a C++ member function and obj is the object having that function.
name | The name of the new operation |
func | A pointer to a function, for example, &Bar::foo (C++ class function). |
obj | A pointer to the object that will execute the function. |
et | The 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 ? |
Definition at line 402 of file Service.hpp.
|
inline |
Add an operation to the interface by means of a free C/C++ function. The function func must be a free C/C++ function.
name | The name of the new operation |
func | A pointer to a C function, for example, &foo (or a static C++ class function). |
et | The 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 ? |
Definition at line 423 of file Service.hpp.
|
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 506 of file Service.hpp.
|
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 521 of file Service.hpp.
|
virtual |
Add a new sub-service to this Service.
obj | This object becomes owned by this Service. |
Definition at line 81 of file Service.cpp.
|
inline |
Add an operation object to the interface. This version exports an existing Operation object to the synchronous interface of the component
op | The operation object to add. |
Definition at line 379 of file Service.hpp.
|
inline |
Add an operation to the synchronous interface by means of a function. The function func must be a C++ Class member function.
name | The name of the new operation |
func | A pointer to a function, for example &Bar::foo (C++ class function). |
obj | A pointer to the object that will execute the function in case of a C++ class function, |
et | The 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 ? |
Definition at line 492 of file Service.hpp.
void RTT::Service::clear | ( | ) |
Clear all added operations, properties and sub-services from this Service.
Definition at line 210 of file Service.cpp.
|
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.
name | The name of this service. |
owner | The TaskContext that will execute the operations of this service. |
Definition at line 50 of file Service.cpp.
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).
name | The name of the operation |
Definition at line 268 of file Service.cpp.
|
inline |
Returns a descriptive text for this service.
Definition at line 144 of file Service.hpp.
|
inline |
Sets the descriptive text for this service.
Definition at line 149 of file Service.hpp.
boost::shared_ptr< base::DisposableInterface > RTT::Service::getLocalOperation | ( | std::string | name | ) |
Get a locally added operation from this interface.
Definition at line 203 of file Service.cpp.
|
inline |
Returns the name of this service instance.
Definition at line 139 of file Service.hpp.
OperationInterfacePart * RTT::Service::getOperation | ( | std::string | name | ) |
Get a previously added operation for use in a C++ OperationCaller object. Store the result of this function in a OperationCaller<Signature> object.
name | The name of the operation to retrieve. |
Definition at line 142 of file Service.cpp.
|
inline |
For internal use only. Get a previously added operation as a DataSource. This function is inferior to getOperation(std::string name)
name | The name of the operation |
args | The arguments of the operation as Data Sources. |
Definition at line 540 of file Service.hpp.
std::vector< std::string > RTT::Service::getOperationNames | ( | ) | const |
Returns the names of all operations added to this interface.
Definition at line 230 of file Service.cpp.
|
inline |
The owner is the top-level TaskContext owning this service (indirectly). A Service can only belong to one TaskContext.
Definition at line 185 of file Service.hpp.
ExecutionEngine * RTT::Service::getOwnerExecutionEngine | ( | ) | const |
Return the execution engine of this service owner.
Definition at line 75 of file Service.cpp.
|
inline |
The parent is the direct parent of this service.
Definition at line 171 of file Service.hpp.
|
virtual |
Return a standard container which contains all the sub-service names of this Service
Definition at line 71 of file Service.cpp.
Service::shared_ptr RTT::Service::getService | ( | const std::string & | service_name | ) |
Returns a shared pointer to strictly a sub-service of a null pointer if !hasService(service_name). This method will not return the this pointer when service_name equals "this" or create new service objects.
service_name | The name of the sub-service to be returned. or created, or the result of provides() in case of "this". |
Definition at line 133 of file Service.cpp.
bool RTT::Service::hasOperation | ( | const std::string & | name | ) | const |
Query for the existence of a Operation in this interface.
Definition at line 236 of file Service.cpp.
bool RTT::Service::hasService | ( | const std::string & | service_name | ) |
Check if this service has the sub-service service_name.
service_name | The name of the sub-service to be queried. |
Definition at line 172 of file Service.cpp.
Service::shared_ptr RTT::Service::provides | ( | ) |
Returns this Service, unless no shared_ptr yet exists.
std::runtime_exception | when no Service::shared_ptr to this exists yet. |
Definition at line 113 of file Service.cpp.
Service::shared_ptr RTT::Service::provides | ( | const std::string & | service_name | ) |
Returns a sub-Service which resorts under this Service, creating a new one if it does not yet exists. Use getService() if no Service object creation should be done.
service_name | The name of the sub-service to be returned or created, or the result of provides() in case of "this". |
Definition at line 123 of file Service.cpp.
void RTT::Service::removeOperation | ( | const std::string & | name | ) |
Removes a previously added operation.
Definition at line 242 of file Service.cpp.
|
virtual |
Remove a previously added sub-service, potentially freeing it (and this) from memory.
service_name | the name of the service to remove. |
Definition at line 103 of file Service.cpp.
bool RTT::Service::resetOperation | ( | std::string | name, |
base::OperationBase * | impl | ||
) |
Reset the implementation of a operation.
Definition at line 152 of file Service.cpp.
|
inline |
Changes the name of this service.
Definition at line 154 of file Service.hpp.
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.
name | The name of the operation to modify. For example, "start". |
et | The ExecutionThread type in which the function of the operation will be executed, being OwnThread or ClientThread. |
Definition at line 160 of file Service.cpp.
void RTT::Service::setOwner | ( | TaskContext * | new_owner | ) |
Sets the owning TaskContext that will execute the operations in this service.
Definition at line 254 of file Service.cpp.
void RTT::Service::setParent | ( | Service::shared_ptr | p | ) |
Sets the parent service in case this service is a sub-service.
Definition at line 264 of file Service.cpp.
|
protected |
|
protected |
Definition at line 571 of file Service.hpp.
|
protected |
Definition at line 570 of file Service.hpp.
|
protected |
Definition at line 572 of file Service.hpp.
|
protected |
Definition at line 569 of file Service.hpp.
|
protected |
Definition at line 573 of file Service.hpp.
|
protected |
the services we implement.
Definition at line 563 of file Service.hpp.
|
protected |
Definition at line 568 of file Service.hpp.