33 #include <boost/noncopyable.hpp>
34 #include <boost/shared_ptr.hpp>
36 #include <rsc/runtime/TypeStringTools.h>
37 #include <rsc/logging/Logger.h>
39 #include "../Informer.h"
40 #include "../Listener.h"
41 #include "../ParticipantConfig.h"
43 #include "rsb/rsbexports.h"
53 class RSB_EXPORT
Server:
public boost::noncopyable {
66 virtual std::string getRequestType()
const = 0;
69 intlCall(
const std::string& methodName,
70 boost::shared_ptr<void> input) = 0;
81 virtual std::string getRequestType()
const;
82 virtual std::string getReplyType()
const;
85 const std::string& replyType);
98 template<
class RequestType>
103 = rsc::runtime::typeName(
typeid(RequestType))) :
118 boost::shared_ptr<RequestType> input) = 0;
121 boost::shared_ptr<void> input) {
122 return call(methodName,
123 boost::static_pointer_cast<RequestType>(input));
136 template<
class RequestType,
class ReplyType>
141 = rsc::runtime::typeName(
typeid(RequestType)),
142 const std::string& replyType
143 = rsc::runtime::typeName(
typeid(ReplyType))) :
157 virtual boost::shared_ptr<ReplyType> call(
const std::string& methodName,
158 boost::shared_ptr<RequestType> input) = 0;
161 boost::shared_ptr<void> input) {
162 return std::make_pair(getReplyType(), call(methodName,
163 boost::static_pointer_cast<RequestType>(input)));
167 template<
class RequestType>
172 = rsc::runtime::typeName(
typeid(RequestType)),
173 const std::string& replyType
174 = rsc::runtime::typeName(
typeid(
void))) :
187 virtual void call(
const std::string& methodName,
188 boost::shared_ptr<RequestType> input) = 0;
191 boost::shared_ptr<void> input) {
192 call(methodName, boost::static_pointer_cast<RequestType>(input));
193 return make_pair(getReplyType(), boost::shared_ptr<void>());
198 template<
class ReplyType>
203 = rsc::runtime::typeName(
typeid(
void)),
204 const std::string& replyType
205 = rsc::runtime::typeName(
typeid(ReplyType))) :
218 virtual boost::shared_ptr<ReplyType> call(
219 const std::string& methodName) = 0;
222 boost::shared_ptr<void> input) {
223 return std::make_pair(getReplyType(), call(methodName));
241 void registerMethod(
const std::string& methodName,
CallbackPtr callback);
251 std::map<std::string, Informer<AnyType>::Ptr>
methods;