RSB  0.19.0
rsb::patterns::LocalServer<> Class Template Referenceabstract

The server side of a request-reply-based communication channel. More...

#include <LocalServer.h>

Inheritance diagram for rsb::patterns::LocalServer<>:
Inheritance graph
Collaboration diagram for rsb::patterns::LocalServer<>:
Collaboration graph

Classes

class  AnyReplyTypeCallback
 A callback which allows any kind of reply type but is restricted to a single request type. More...
 
class  Callback
 Callback object used to register one method for a server. More...
 
class  Callback< RequestType, void >
 
class  Callback< void, ReplyType >
 
class  CallbackBase
 Base class for callback classes. More...
 
class  EventCallback
 Callback class with receives and returns events. More...
 
class  FunctionCallback
 An adapter to use boost functions for callbacks. More...
 
class  FunctionCallback< RequestType, void >
 An adapter to use boost functions without out return values as calblacks. More...
 
class  FunctionCallback< void, ReplyType >
 An adapter to use boost functions without a call argument for callbacks. More...
 
class  IntlCallback
 Callback object interface to implement for registering callable methods. More...
 
class  LocalMethod
 A derived Method class which can be called from the remote side and implements its behavior by invoking a client-supplied callback. More...
 

Public Types

typedef boost::shared_ptr< IntlCallbackCallbackPtr
 
typedef boost::shared_ptr< LocalMethodLocalMethodPtr
 
typedef boost::function< void(void)> FunctionType
 Type of functions that can be accepted. More...
 

Public Member Functions

 LocalServer (const Scope &scope, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
 
virtual ~LocalServer ()
 
virtual std::string getKind () const
 Return the kind of the participant. More...
 
virtual const std::set< std::string > getTransportURLs () const
 TODO. More...
 
void registerMethod (const std::string &name, CallbackPtr callback)
 Register a new method with the given name. More...
 
 Callback ()
 
virtual void call (const std::string &methodName)=0
 Implement this method to perform actions. More...
 
 FunctionCallback (FunctionType function, const std::string &requestType=rsc::runtime::typeName(typeid(void)), const std::string &replyType=rsc::runtime::typeName(typeid(void)))
 
- 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

EventPtr intlCall (const std::string &methodName, EventPtr)
 
EventPtr intlCall (const std::string &, EventPtr)
 

Private Attributes

ParticipantConfig listenerConfig
 
ParticipantConfig informerConfig
 
std::map< std::string, LocalMethodPtrmethods
 
FunctionType function
 

Additional Inherited Members

- Protected Member Functions inherited from rsb::Participant
 Participant (const Scope &scope, const ParticipantConfig &config)
 

Detailed Description

template<>
class rsb::patterns::LocalServer<>

The server side of a request-reply-based communication channel.

An adapter to use boost functions without a call argument and without return values for callbacks.

A callback which does not take a request and does not produce a result.

Author
jwienke
jmoringe
jmoringe.
jwienke

Definition at line 54 of file LocalServer.h.

Member Typedef Documentation

typedef boost::shared_ptr<IntlCallback> rsb::patterns::LocalServer<>::CallbackPtr

Definition at line 71 of file LocalServer.h.

typedef boost::function<void(void)> rsb::patterns::LocalServer<>::FunctionType

Type of functions that can be accepted.

Definition at line 467 of file LocalServer.h.

typedef boost::shared_ptr<LocalMethod> rsb::patterns::LocalServer<>::LocalMethodPtr

Definition at line 387 of file LocalServer.h.

Constructor & Destructor Documentation

rsb::patterns::LocalServer<>::LocalServer ( const Scope scope,
const ParticipantConfig listenerConfig,
const ParticipantConfig informerConfig 
)

Definition at line 129 of file LocalServer.cpp.

Definition at line 137 of file LocalServer.cpp.

References rsb::patterns::LocalServer<>::methods.

Member Function Documentation

virtual void rsb::patterns::LocalServer<>::call ( const std::string &  methodName)
pure virtual

Implement this method to perform actions.

Parameters
methodNamecalled method
Exceptions
std::exceptionall exceptions based on this type are automatically caught and delivered to the remote server

Referenced by rsb::patterns::LocalServer<>::EventCallback::intlCall().

Here is the caller graph for this function:

Definition at line 430 of file LocalServer.h.

rsb::patterns::LocalServer<>::FunctionCallback ( FunctionType  function,
const std::string &  requestType = rsc::runtime::typeName(                    typeid(void)),
const std::string &  replyType = rsc::runtime::typeName(typeid(void)) 
)
inlineexplicit

Definition at line 469 of file LocalServer.h.

std::string rsb::patterns::LocalServer<>::getKind ( ) const
virtual

Return the kind of the participant.

Examples include "informer", "listener" and "reader".

Returns
a string describing the kind of the participant.

Implements rsb::Participant.

Definition at line 144 of file LocalServer.cpp.

const std::set< std::string > rsb::patterns::LocalServer<>::getTransportURLs ( ) const
virtual

TODO.

Implements rsb::Participant.

Definition at line 148 of file LocalServer.cpp.

EventPtr rsb::patterns::LocalServer<>::intlCall ( const std::string &  methodName,
EventPtr   
)
inlineprivate

Definition at line 445 of file LocalServer.h.

EventPtr rsb::patterns::LocalServer<>::intlCall ( const std::string &  ,
EventPtr   
)
inlineprivate

Definition at line 478 of file LocalServer.h.

void rsb::patterns::LocalServer<>::registerMethod ( const std::string &  name,
CallbackPtr  callback 
)

Register a new method with the given name.

Parameters
nameName of the new method. Has to be a legal scope component string.
callbackcallback to execute for the method
Exceptions
MethodExistsExceptionthrown if a method with this name already exists

Definition at line 152 of file LocalServer.cpp.

References rsb::Factory::createLocalMethod(), rsb::getFactory(), rsb::Participant::getScope(), rsb::patterns::LocalServer<>::informerConfig, rsb::patterns::LocalServer<>::listenerConfig, and rsb::patterns::LocalServer<>::methods.

Here is the call graph for this function:

Member Data Documentation

Definition at line 486 of file LocalServer.h.

ParticipantConfig rsb::patterns::LocalServer<>::informerConfig
private

Definition at line 411 of file LocalServer.h.

Referenced by rsb::patterns::LocalServer<>::registerMethod().

ParticipantConfig rsb::patterns::LocalServer<>::listenerConfig
private

Definition at line 410 of file LocalServer.h.

Referenced by rsb::patterns::LocalServer<>::registerMethod().


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