RSB
0.7.0
|
The client side of a request-reply-based communication channel. More...
#include <RemoteServer.h>
Classes | |
class | DataFuture |
class | MethodSet |
Public Types | |
typedef rsc::threading::Future < EventPtr > | FutureType |
typedef boost::shared_ptr < FutureType > | FuturePtr |
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. | |
virtual | ~RemoteServer () |
template<class I > | |
EventPtr | prepareRequestEvent (boost::shared_ptr< I > args) |
Prepares an Event which can be used for a request based on typed data. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. |
Private Member Functions | |
MethodSet | getMethodSet (const std::string &methodName, const std::string &sendType) |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
Scope | scope |
ParticipantConfig | listenerConfig |
ParticipantConfig | informerConfig |
boost::mutex | methodSetMutex |
std::map< std::string, MethodSet > | methodSets |
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 62 of file RemoteServer.h.
typedef boost::shared_ptr<FutureType> rsb::patterns::RemoteServer::FuturePtr |
Definition at line 65 of file RemoteServer.h.
typedef rsc::threading::Future<EventPtr> rsb::patterns::RemoteServer::FutureType |
Definition at line 64 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 115 of file RemoteServer.cpp.
|
virtual |
Definition at line 129 of file RemoteServer.cpp.
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 197 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 210 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 235 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 getMethodSet(), rsb::Participant::getScope(), rsb::patterns::RemoteServer::MethodSet::handler, logger, rsb::Informer< T >::publish(), and rsb::patterns::RemoteServer::MethodSet::requestInformer.
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 140 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 157 of file RemoteServer.h.
|
private |
Definition at line 132 of file RemoteServer.cpp.
References rsb::Scope::concat(), informerConfig, listenerConfig, logger, rsb::patterns::RemoteServer::MethodSet::methodName, methodSetMutex, methodSets, and scope.
Referenced by callAsync().
|
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 104 of file RemoteServer.h.
|
private |
Definition at line 244 of file RemoteServer.h.
Referenced by getMethodSet().
|
private |
Definition at line 243 of file RemoteServer.h.
Referenced by getMethodSet().
|
private |
Definition at line 240 of file RemoteServer.h.
Referenced by callAsync(), and getMethodSet().
|
private |
Definition at line 255 of file RemoteServer.h.
Referenced by getMethodSet().
|
private |
Definition at line 256 of file RemoteServer.h.
Referenced by getMethodSet().
|
private |
Definition at line 242 of file RemoteServer.h.
Referenced by getMethodSet().