From 2ba5228d0483798a9e122670d15a078c4478898f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 15 Sep 2009 16:11:54 +0200 Subject: Added UserListManager module --- src/Common/RequestManager.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/Common') diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h index 4704a0f..aef6b90 100644 --- a/src/Common/RequestManager.h +++ b/src/Common/RequestManager.h @@ -70,12 +70,12 @@ class MAD_COMMON_EXPORT RequestManager : private boost::noncopyable { - template class RequestHandlerFactory : public RequestHandlerGroup { + template class RequestHandlerFactory0 : public RequestHandlerGroup { private: std::set types; public: - RequestHandlerFactory(const std::string &type) { + RequestHandlerFactory0(const std::string &type) { types.insert(type); } @@ -88,6 +88,25 @@ class MAD_COMMON_EXPORT RequestManager : private boost::noncopyable { } }; + template class RequestHandlerFactory1 : public RequestHandlerGroup { + private: + std::set types; + T1 arg1; + + public: + RequestHandlerFactory1(const std::string &type, T1 argT1) : arg1(argT1) { + types.insert(type); + } + + virtual const std::set& getPacketTypes() { + return types; + } + + virtual boost::shared_ptr createRequestHandler(Application *application, const std::string& /*type*/) { + return boost::shared_ptr(new T(application, arg1)); + } + }; + Application *application; boost::shared_mutex mutex; @@ -146,7 +165,11 @@ class MAD_COMMON_EXPORT RequestManager : private boost::noncopyable { } template void registerPacketType(const std::string &type) { - registerRequestHandlerGroup(boost::shared_ptr >(new RequestHandlerFactory(type))); + registerRequestHandlerGroup(boost::shared_ptr >(new RequestHandlerFactory0(type))); + } + + template void registerPacketType(const std::string &type, T1 arg1) { + registerRequestHandlerGroup(boost::shared_ptr >(new RequestHandlerFactory1(type, arg1))); } void unregisterPacketType(const std::string &type) { -- cgit v1.2.3