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>());