summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-09-15 16:11:54 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-09-15 16:11:54 +0200
commit2ba5228d0483798a9e122670d15a078c4478898f (patch)
tree5c4a46d6410d866afc94f6d2ce0aeb99665ae831 /src/Common
parent7f4f260d732c849c1e88fcb91023faab5316d9c6 (diff)
downloadmad-2ba5228d0483798a9e122670d15a078c4478898f.tar
mad-2ba5228d0483798a9e122670d15a078c4478898f.zip
Added UserListManager module
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/RequestManager.h29
1 files changed, 26 insertions, 3 deletions
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 T> class RequestHandlerFactory : public RequestHandlerGroup {
+ template<typename T> class RequestHandlerFactory0 : public RequestHandlerGroup {
private:
std::set<std::string> 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<typename T, typename T1> class RequestHandlerFactory1 : public RequestHandlerGroup {
+ private:
+ std::set<std::string> types;
+ T1 arg1;
+
+ public:
+ RequestHandlerFactory1(const std::string &type, T1 argT1) : arg1(argT1) {
+ types.insert(type);
+ }
+
+ virtual const std::set<std::string>& getPacketTypes() {
+ return types;
+ }
+
+ virtual boost::shared_ptr<RequestHandler> createRequestHandler(Application *application, const std::string& /*type*/) {
+ return boost::shared_ptr<RequestHandler>(new T(application, arg1));
+ }
+ };
+
Application *application;
boost::shared_mutex mutex;
@@ -146,7 +165,11 @@ class MAD_COMMON_EXPORT RequestManager : private boost::noncopyable {
}
template <class T> void registerPacketType(const std::string &type) {
- registerRequestHandlerGroup(boost::shared_ptr<RequestHandlerFactory<T> >(new RequestHandlerFactory<T>(type)));
+ registerRequestHandlerGroup(boost::shared_ptr<RequestHandlerFactory0<T> >(new RequestHandlerFactory0<T>(type)));
+ }
+
+ template <class T, class T1> void registerPacketType(const std::string &type, T1 arg1) {
+ registerRequestHandlerGroup(boost::shared_ptr<RequestHandlerFactory1<T, T1> >(new RequestHandlerFactory1<T, T1>(type, arg1)));
}
void unregisterPacketType(const std::string &type) {