Orocos Real-Time Toolkit
2.9.0
|
An object that expresses you wish to use a service. More...
#include <rtt/ServiceRequester.hpp>
Public Types | |
typedef std::vector< std::string > | RequesterNames |
typedef std::vector< std::string > | OperationCallerNames |
typedef boost::shared_ptr< ServiceRequester > | shared_ptr |
typedef boost::shared_ptr< const ServiceRequester > | shared_constptr |
Public Member Functions | |
ServiceRequester (const std::string &name, TaskContext *owner=0) | |
virtual | ~ServiceRequester () |
const std::string & | getRequestName () const |
RequesterNames | getRequesterNames () const |
TaskContext * | getServiceOwner () const |
The owner is the top-level TaskContext owning this service (indirectly). More... | |
void | setOwner (TaskContext *new_owner) |
Sets the owning TaskContext that is considered as the caller of requested operations. More... | |
Service::shared_ptr | getReferencedService () |
Returns the service we're referencing. More... | |
bool | addOperationCaller (base::OperationCallerBaseInvoker &mbi) |
OperationCallerNames | getOperationCallerNames () const |
base::OperationCallerBaseInvoker * | getOperationCaller (const std::string &name) |
ServiceRequester::shared_ptr | requires () |
ServiceRequester::shared_ptr | requires (const std::string &service_name) |
bool | addServiceRequester (shared_ptr obj) |
Add a new ServiceRequester to this TaskContext. More... | |
bool | requiresService (const std::string &service_name) |
Query if this service requires certain sub-services. More... | |
virtual bool | connectTo (Service::shared_ptr sp) |
Connects this service's methods to the operations provided by op. More... | |
virtual bool | ready () const |
Returns true when all methods were resolved. More... | |
virtual void | disconnect () |
Disconnects all methods from their implementation. More... | |
virtual void | clear () |
Remove all operation callers from this service requester. More... | |
Protected Types | |
typedef std::map< std::string, ServiceRequester::shared_ptr > | Requests |
typedef std::map< std::string, base::OperationCallerBaseInvoker * > | OperationCallers |
Our methods. More... | |
Protected Attributes | |
Requests | mrequests |
the services we implement. More... | |
OperationCallers | mmethods |
std::string | mrname |
TaskContext * | mrowner |
Service::shared_ptr | mprovider |
An object that expresses you wish to use a service.
The ServiceRequester is symmetrical to the Service. Where a Service registers operations that a component can execute ('provides'), the ServiceRequester registers the methods that a caller wishes to call ('requires'). One method in a ServiceRequester maps to one operation in a Service.
Typical use is to inherit from ServiceRequester and add named OperationCaller objects to it using addOperationCaller.
Definition at line 72 of file ServiceRequester.hpp.
typedef std::vector<std::string> RTT::ServiceRequester::OperationCallerNames |
Definition at line 86 of file ServiceRequester.hpp.
|
protected |
Our methods.
Definition at line 186 of file ServiceRequester.hpp.
typedef std::vector<std::string> RTT::ServiceRequester::RequesterNames |
Definition at line 85 of file ServiceRequester.hpp.
|
protected |
Definition at line 181 of file ServiceRequester.hpp.
typedef boost::shared_ptr<const ServiceRequester> RTT::ServiceRequester::shared_constptr |
Definition at line 88 of file ServiceRequester.hpp.
typedef boost::shared_ptr<ServiceRequester> RTT::ServiceRequester::shared_ptr |
Definition at line 87 of file ServiceRequester.hpp.
RTT::ServiceRequester::ServiceRequester | ( | const std::string & | name, |
TaskContext * | owner = 0 |
||
) |
Definition at line 54 of file ServiceRequester.cpp.
|
virtual |
Definition at line 59 of file ServiceRequester.cpp.
bool RTT::ServiceRequester::addOperationCaller | ( | base::OperationCallerBaseInvoker & | mbi | ) |
Definition at line 63 of file ServiceRequester.cpp.
References RTT::Error, RTT::base::OperationCallerBaseInvoker::getName(), and mmethods.
Referenced by RTT::Marshalling::Marshalling(), and RTT::Scripting::Scripting().
bool RTT::ServiceRequester::addServiceRequester | ( | ServiceRequester::shared_ptr | obj | ) |
Add a new ServiceRequester to this TaskContext.
obj | This object becomes owned by this TaskContext. |
Definition at line 126 of file ServiceRequester.cpp.
References RTT::Error, mrequests, and mrowner.
Referenced by requires().
|
virtual |
Remove all operation callers from this service requester.
Definition at line 189 of file ServiceRequester.cpp.
|
virtual |
Connects this service's methods to the operations provided by op.
This method tries to match as many as possible method-operation pairs.
You may call this function with different instances of sp to 'resolve' missing functions, only the non-connected methods will be further filled in.
sp | An interface-compatible Service. |
Definition at line 140 of file ServiceRequester.cpp.
References RTT::Debug, RTT::base::TaskCore::engine(), RTT::Info, mmethods, mprovider, mrname, mrowner, and ready().
|
virtual |
Disconnects all methods from their implementation.
Definition at line 172 of file ServiceRequester.cpp.
References RTT::base::OperationCallerBaseInvoker::disconnect(), and mmethods.
OperationCallerBaseInvoker * RTT::ServiceRequester::getOperationCaller | ( | const std::string & | name | ) |
Definition at line 84 of file ServiceRequester.cpp.
References mmethods.
std::vector< std::string > RTT::ServiceRequester::getOperationCallerNames | ( | ) | const |
Definition at line 74 of file ServiceRequester.cpp.
References RTT::internal::keys(), and mmethods.
|
inline |
Returns the service we're referencing.
In case you used connectTo to more than one service, this returns the service which was used when connectTo first returned true.
Definition at line 120 of file ServiceRequester.hpp.
std::vector< std::string > RTT::ServiceRequester::getRequesterNames | ( | ) | const |
Definition at line 79 of file ServiceRequester.cpp.
References RTT::internal::keys(), and mrequests.
|
inline |
Definition at line 98 of file ServiceRequester.hpp.
|
inline |
The owner is the top-level TaskContext owning this service (indirectly).
Definition at line 106 of file ServiceRequester.hpp.
|
virtual |
Returns true when all methods were resolved.
Definition at line 179 of file ServiceRequester.cpp.
References RTT::Debug, and mmethods.
Referenced by connectTo().
ServiceRequester::shared_ptr RTT::ServiceRequester::requires | ( | ) |
Definition at line 103 of file ServiceRequester.cpp.
References RTT::Error.
Referenced by requires().
ServiceRequester::shared_ptr RTT::ServiceRequester::requires | ( | const std::string & | service_name | ) |
Definition at line 114 of file ServiceRequester.cpp.
References addServiceRequester(), mrequests, mrowner, and requires().
|
inline |
Query if this service requires certain sub-services.
service_name |
Definition at line 147 of file ServiceRequester.hpp.
void RTT::ServiceRequester::setOwner | ( | TaskContext * | new_owner | ) |
Sets the owning TaskContext that is considered as the caller of requested operations.
Definition at line 92 of file ServiceRequester.cpp.
References RTT::base::TaskCore::engine(), mmethods, mrequests, and mrowner.
|
protected |
Definition at line 187 of file ServiceRequester.hpp.
Referenced by addOperationCaller(), clear(), connectTo(), disconnect(), getOperationCaller(), getOperationCallerNames(), ready(), and setOwner().
|
protected |
Definition at line 191 of file ServiceRequester.hpp.
Referenced by connectTo().
|
protected |
the services we implement.
Definition at line 183 of file ServiceRequester.hpp.
Referenced by addServiceRequester(), clear(), getRequesterNames(), requires(), and setOwner().
|
protected |
Definition at line 189 of file ServiceRequester.hpp.
Referenced by connectTo().
|
protected |
Definition at line 190 of file ServiceRequester.hpp.
Referenced by addServiceRequester(), connectTo(), requires(), and setOwner().