RSB
0.15.1
|
The client side of a request-reply-based communication channel. More...
#include <RemoteServer.h>
Classes | |
class | DataFuture |
class | DataFuture< void > |
class | RemoteMethod |
A derived Method class which can be used to invoke methods on a remote LocalServer object. More... | |
Public Types | |
typedef rsc::threading::Future< EventPtr > | FutureType |
typedef boost::shared_ptr< FutureType > | FuturePtr |
typedef boost::shared_ptr< RemoteMethod > | RemoteMethodPtr |
Public Member Functions | |
RemoteServer (const Scope &scope, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig) | |
Construct a new RemoteServer object which can be used to call methods of the server at scope. More... | |
virtual | ~RemoteServer () |
virtual std::string | getKind () const |
Return the kind of the participant. More... | |
virtual const std::set< std::string > | getTransportURLs () const |
TODO. More... | |
template<class I > | |
EventPtr | prepareRequestEvent (boost::shared_ptr< I > args) |
Prepares an Event which can be used for a request based on typed data. More... | |
FuturePtr | callAsync (const std::string &methodName, EventPtr data) |
Call the method named methodName on the remote server, passing it the event data as argument and returning an event which contains the value returned by the remote method. More... | |
template<typename O , typename I > | |
DataFuture< O > | callAsync (const std::string &methodName, boost::shared_ptr< I > args) |
Call the method named methodName on the remote server, passing it the argument object args and returning the value returned by the remote method. More... | |
template<typename O > | |
DataFuture< O > | callAsync (const std::string &methodName) |
Call the method named methodName on the remote server, without arguments and returning the value returned by the remote method. More... | |
EventPtr | call (const std::string &methodName, EventPtr data, unsigned int maxReplyWaitTime=25) |
Call the method named methodName on the remote server, passing it the event data as argument and returning an event which contains the value returned by the remote method. More... | |
template<typename O , typename I > | |
boost::shared_ptr< O > | call (const std::string &methodName, boost::shared_ptr< I > args, unsigned int maxReplyWaitTime=25) |
Call the method named methodName on the remote server, passing it the argument object args and return the value returned by the remote method. More... | |
template<typename O > | |
boost::shared_ptr< O > | call (const std::string &methodName, unsigned int maxReplyWaitTime=25) |
Call the method named methodName on the remote server, without arguments and return the value returned by the remote method. More... | |
Public Member Functions inherited from rsb::Participant | |
virtual | ~Participant () |
void | printContents (std::ostream &stream) const |
rsc::misc::UUID | getId () const |
Returns the unique id of the participant. More... | |
ScopePtr | getScope () const |
Returns the scope of this participant. More... | |
ParticipantConfig | getConfig () const |
Returns a copy of the participant's configuration. More... | |
Private Member Functions | |
RemoteMethodPtr | getMethod (const std::string &name) |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
ParticipantConfig | listenerConfig |
ParticipantConfig | informerConfig |
boost::mutex | methodsMutex |
std::map< std::string, RemoteMethodPtr > | methods |
Additional Inherited Members | |
Protected Member Functions inherited from rsb::Participant | |
Participant (const Scope &scope, const ParticipantConfig &config) | |
The client side of a request-reply-based communication channel.
Objects of this class represent remote servers in a way that allows calling methods on them as if they were local.
Definition at line 60 of file RemoteServer.h.
typedef boost::shared_ptr<FutureType> rsb::patterns::RemoteServer::FuturePtr |
Definition at line 64 of file RemoteServer.h.
typedef rsc::threading::Future<EventPtr> rsb::patterns::RemoteServer::FutureType |
Definition at line 63 of file RemoteServer.h.
typedef boost::shared_ptr<RemoteMethod> rsb::patterns::RemoteServer::RemoteMethodPtr |
Definition at line 115 of file RemoteServer.h.
rsb::patterns::RemoteServer::RemoteServer | ( | const Scope & | scope, |
const ParticipantConfig & | listenerConfig, | ||
const ParticipantConfig & | informerConfig | ||
) |
Construct a new RemoteServer
object which can be used to call methods of the server at scope.
scope | The base scope of the server the methods of which will be called. |
Definition at line 129 of file RemoteServer.cpp.
|
virtual |
Definition at line 141 of file RemoteServer.cpp.
References methods.
EventPtr rsb::patterns::RemoteServer::call | ( | const std::string & | methodName, |
EventPtr | data, | ||
unsigned int | maxReplyWaitTime = 25 |
||
) |
Call the method named methodName on the remote server, passing it the event data as argument and returning an event which contains the value returned by the remote method.
This method blocks until the computation on the remote side has been completed and the result has been received.
methodName | Name of the method that should be called. |
data | An Event object containing the argument object that should be passed to the called method. |
maxReplyWaitTime | Maximum number of seconds to wait for a reply from the server when calling a method. |
rsc::threading::FutureTimeoutException | if the method call is not completed within the maximum waiting time. |
rsc::threading::FutureTaskExecutionException | if the method call fails. |
Definition at line 184 of file RemoteServer.cpp.
References callAsync().
|
inline |
Call the method named methodName on the remote server, passing it the argument object args and return the value returned by the remote method.
This method blocks until the computation on the remote side has been completed and the result has been received.
I | type of the method call argument object. |
O | type of the method return value. |
methodName | Name of the method that should be called. |
args | The argument object that should be passed to the called method. |
maxReplyWaitTime | Maximum number of seconds to wait for a reply from the server when calling a method. |
rsc::threading::FutureTimeoutException | if the method call is not completed within the maximum waiting time. |
rsc::threading::FutureTaskExecutionException | if the method call fails. |
Definition at line 249 of file RemoteServer.h.
|
inline |
Call the method named methodName on the remote server, without arguments and return the value returned by the remote method.
This method blocks until the computation on the remote side has been completed and the result has been received.
O | type of the method return value. |
methodName | Name of the method that should be called. |
maxReplyWaitTime | Maximum number of seconds to wait for a reply from the server when calling a method. |
rsc::threading::FutureTimeoutException | if the method call is not completed within the maximum waiting time. |
rsc::threading::FutureTaskExecutionException | if the method call fails. |
Definition at line 274 of file RemoteServer.h.
RemoteServer::FuturePtr rsb::patterns::RemoteServer::callAsync | ( | const std::string & | methodName, |
EventPtr | data | ||
) |
Call the method named methodName on the remote server, passing it the event data as argument and returning an event which contains the value returned by the remote method.
methodName | Name of the method that should be called. |
data | An Event object containing the argument object that should be passed to the called method. |
Definition at line 176 of file RemoteServer.cpp.
References getMethod(), and logger.
Referenced by call().
|
inline |
Call the method named methodName on the remote server, passing it the argument object args and returning the value returned by the remote method.
I | type of the method call argument object. |
O | type of the method return value. |
methodName | Name of the method that should be called. |
args | The argument object that should be passed to the called method. |
Definition at line 179 of file RemoteServer.h.
|
inline |
Call the method named methodName on the remote server, without arguments and returning the value returned by the remote method.
O | type of the method return value. |
methodName | Name of the method that should be called. |
Definition at line 196 of file RemoteServer.h.
|
virtual |
Return the kind of the participant.
Examples include "informer"
, "listener"
and "reader"
.
Implements rsb::Participant.
Definition at line 148 of file RemoteServer.cpp.
|
private |
Definition at line 156 of file RemoteServer.cpp.
References rsb::Factory::createRemoteMethod(), rsb::getFactory(), rsb::Participant::getScope(), informerConfig, listenerConfig, methods, and methodsMutex.
Referenced by callAsync().
|
virtual |
|
inline |
Prepares an Event which can be used for a request based on typed data.
args | data for the event |
I | data type for the data in the event |
Definition at line 143 of file RemoteServer.h.
|
private |
Definition at line 283 of file RemoteServer.h.
Referenced by getMethod().
|
private |
Definition at line 282 of file RemoteServer.h.
Referenced by getMethod().
|
private |
Definition at line 280 of file RemoteServer.h.
Referenced by callAsync().
|
private |
Definition at line 286 of file RemoteServer.h.
Referenced by getMethod(), and ~RemoteServer().
|
private |
Definition at line 285 of file RemoteServer.h.
Referenced by getMethod().