34 #include <boost/noncopyable.hpp>
35 #include <boost/shared_ptr.hpp>
37 #include <rsc/runtime/TypeStringTools.h>
38 #include <rsc/logging/Logger.h>
40 #include "../Informer.h"
41 #include "../Listener.h"
42 #include "../ParticipantConfig.h"
44 #include "rsb/rsbexports.h"
54 class RSB_EXPORT
Server:
public boost::noncopyable {
67 virtual const std::string& getRequestType()
const = 0;
70 intlCall(
const std::string& methodName,
71 boost::shared_ptr<void> input) = 0;
82 virtual const std::string& getRequestType()
const;
83 virtual const std::string& getReplyType()
const;
86 const std::string& replyType);
99 template<
class RequestType>
104 = rsc::runtime::typeName(
typeid(RequestType))) :
119 boost::shared_ptr<RequestType> input) = 0;
122 boost::shared_ptr<void> input) {
123 return call(methodName,
124 boost::static_pointer_cast<RequestType>(input));
137 template<
class RequestType,
class ReplyType>
142 = rsc::runtime::typeName(
typeid(RequestType)),
143 const std::string& replyType
144 = rsc::runtime::typeName(
typeid(ReplyType))) :
158 virtual boost::shared_ptr<ReplyType> call(
const std::string& methodName,
159 boost::shared_ptr<RequestType> input) = 0;
162 boost::shared_ptr<void> input) {
163 return std::make_pair(getReplyType(), call(methodName,
164 boost::static_pointer_cast<RequestType>(input)));
168 template<
class RequestType>
173 = rsc::runtime::typeName(
typeid(RequestType)),
174 const std::string& replyType
175 = rsc::runtime::typeName(
typeid(
void))) :
188 virtual void call(
const std::string& methodName,
189 boost::shared_ptr<RequestType> input) = 0;
192 boost::shared_ptr<void> input) {
193 call(methodName, boost::static_pointer_cast<RequestType>(input));
194 return make_pair(getReplyType(), boost::shared_ptr<void>());
199 template<
class ReplyType>
204 = rsc::runtime::typeName(
typeid(
void)),
205 const std::string& replyType
206 = rsc::runtime::typeName(
typeid(ReplyType))) :
219 virtual boost::shared_ptr<ReplyType> call(
220 const std::string& methodName) = 0;
223 boost::shared_ptr<void> input) {
224 return std::make_pair(getReplyType(), call(methodName));
242 void registerMethod(
const std::string& methodName,
CallbackPtr callback);
252 std::map<std::string, Informer<AnyType>::Ptr>
methods;
272 rsc::runtime::typeName(typeid(void))) {
283 virtual void call(
const std::string& methodName) = 0;
286 boost::shared_ptr<void> ) {
288 return std::make_pair(getReplyType(), boost::shared_ptr<void>());
boost::shared_ptr< IntlCallback > CallbackPtr
std::map< std::string, Informer< AnyType >::Ptr > methods
std::pair< std::string, boost::shared_ptr< void > > AnnotatedData
A combination of data type and the actual data.
ParticipantConfig informerConfig
Callback object interface to implement for registering callable methods.
ParticipantConfig listenerConfig
Callback(const std::string &requestType=rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType=rsc::runtime::typeName(typeid(ReplyType)))
AnnotatedData intlCall(const std::string &methodName, boost::shared_ptr< void > input)
AnnotatedData intlCall(const std::string &methodName, boost::shared_ptr< void > input)
Callback(const std::string &requestType=rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType=rsc::runtime::typeName(typeid(void)))
boost::shared_ptr< Server > ServerPtr
A callback which allows any kind of reply type but is restricted to a single request type...
AnnotatedData intlCall(const std::string &methodName, boost::shared_ptr< void > input)
A class describing the configuration of Participant instances.
AnyReplyTypeCallback(const std::string &requestType=rsc::runtime::typeName(typeid(RequestType)))
Base class for callback classes.
AnnotatedData intlCall(const std::string &methodName, boost::shared_ptr< void >)
Callback object used to register one method for a server.
std::set< ListenerPtr > requestListeners
The server side of a request-reply-based communication channel.
Scope is a descriptor for a hierarchical channel of the unified bus.
AnnotatedData intlCall(const std::string &methodName, boost::shared_ptr< void > input)
Callback(const std::string &requestType=rsc::runtime::typeName(typeid(void)), const std::string &replyType=rsc::runtime::typeName(typeid(ReplyType)))