Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
RTT::ServiceRequester Class Reference

#include <ServiceRequester.hpp>

Inheritance diagram for RTT::ServiceRequester:
Inheritance graph
[legend]

Public Types

typedef std::vector< std::string > OperationCallerNames
 
typedef std::vector< std::string > RequesterNames
 
typedef boost::shared_ptr< const ServiceRequestershared_constptr
 
typedef boost::shared_ptr< ServiceRequestershared_ptr
 

Public Member Functions

bool addOperationCaller (base::OperationCallerBaseInvoker &mbi)
 
bool addServiceRequester (shared_ptr obj)
 
virtual void clear ()
 
virtual bool connectTo (Service::shared_ptr sp)
 
virtual void disconnect ()
 
base::OperationCallerBaseInvokergetOperationCaller (const std::string &name)
 
OperationCallerNames getOperationCallerNames () const
 
Service::shared_ptr getReferencedService ()
 
RequesterNames getRequesterNames () const
 
const std::string & getRequestName () const
 
TaskContextgetServiceOwner () const
 
virtual bool ready () const
 
ServiceRequester::shared_ptr requires ()
 
ServiceRequester::shared_ptr requires (const std::string &service_name)
 
bool requiresService (const std::string &service_name)
 
 ServiceRequester (const std::string &name, TaskContext *owner=0)
 
void setOwner (TaskContext *new_owner)
 
virtual ~ServiceRequester ()
 

Protected Types

typedef std::map< std::string, base::OperationCallerBaseInvoker * > OperationCallers
 Our methods. More...
 
typedef std::map< std::string, ServiceRequester::shared_ptrRequests
 

Protected Attributes

OperationCallers mmethods
 
Service::shared_ptr mprovider
 
Requests mrequests
 the services we implement. More...
 
std::string mrname
 
TaskContextmrowner
 

Detailed Description

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.

See also
RTT::Scripting for an example.

Definition at line 72 of file ServiceRequester.hpp.

Member Typedef Documentation

typedef std::vector<std::string> RTT::ServiceRequester::OperationCallerNames

Definition at line 86 of file ServiceRequester.hpp.

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.

typedef std::map< std::string, ServiceRequester::shared_ptr > RTT::ServiceRequester::Requests
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.

Examples:
/tmp/ws/src/rtt/rtt/TaskContext.hpp.

Definition at line 87 of file ServiceRequester.hpp.

Constructor & Destructor Documentation

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

Definition at line 54 of file ServiceRequester.cpp.

RTT::ServiceRequester::~ServiceRequester ( )
virtual

Definition at line 59 of file ServiceRequester.cpp.

Member Function Documentation

bool RTT::ServiceRequester::addOperationCaller ( base::OperationCallerBaseInvoker mbi)

Definition at line 63 of file ServiceRequester.cpp.

bool RTT::ServiceRequester::addServiceRequester ( ServiceRequester::shared_ptr  obj)

Add a new ServiceRequester to this TaskContext.

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

Definition at line 126 of file ServiceRequester.cpp.

void RTT::ServiceRequester::clear ( )
virtual

Remove all operation callers from this service requester.

Definition at line 189 of file ServiceRequester.cpp.

bool RTT::ServiceRequester::connectTo ( Service::shared_ptr  sp)
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.

Parameters
spAn interface-compatible Service.
Returns
true if all methods of that are required are provided, false if not all methods could yet be matched.

Definition at line 140 of file ServiceRequester.cpp.

void RTT::ServiceRequester::disconnect ( )
virtual

Disconnects all methods from their implementation.

Definition at line 172 of file ServiceRequester.cpp.

OperationCallerBaseInvoker * RTT::ServiceRequester::getOperationCaller ( const std::string &  name)

Definition at line 84 of file ServiceRequester.cpp.

std::vector< std::string > RTT::ServiceRequester::getOperationCallerNames ( ) const

Definition at line 74 of file ServiceRequester.cpp.

Service::shared_ptr RTT::ServiceRequester::getReferencedService ( )
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.

const std::string& RTT::ServiceRequester::getRequestName ( ) const
inline

Definition at line 98 of file ServiceRequester.hpp.

TaskContext* RTT::ServiceRequester::getServiceOwner ( ) const
inline

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

Definition at line 106 of file ServiceRequester.hpp.

bool RTT::ServiceRequester::ready ( ) const
virtual

Returns true when all methods were resolved.

Returns

Definition at line 179 of file ServiceRequester.cpp.

ServiceRequester::shared_ptr RTT::ServiceRequester::requires ( )

Definition at line 103 of file ServiceRequester.cpp.

ServiceRequester::shared_ptr RTT::ServiceRequester::requires ( const std::string &  service_name)

Definition at line 114 of file ServiceRequester.cpp.

bool RTT::ServiceRequester::requiresService ( const std::string &  service_name)
inline

Query if this service requires certain sub-services.

Parameters
service_name
Returns

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.

Member Data Documentation

OperationCallers RTT::ServiceRequester::mmethods
protected

Definition at line 187 of file ServiceRequester.hpp.

Service::shared_ptr RTT::ServiceRequester::mprovider
protected

Definition at line 191 of file ServiceRequester.hpp.

Requests RTT::ServiceRequester::mrequests
protected

the services we implement.

Definition at line 183 of file ServiceRequester.hpp.

std::string RTT::ServiceRequester::mrname
protected

Definition at line 189 of file ServiceRequester.hpp.

TaskContext* RTT::ServiceRequester::mrowner
protected

Definition at line 190 of file ServiceRequester.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:46