summaryrefslogtreecommitdiffstats
path: root/src/Common/RequestManager.h
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-07-08 22:31:29 +0200
committerMatthias Schiffer <matthias@gamezock.de>2008-07-08 22:31:29 +0200
commit1508969d508e41de824d1d1227be708136760cfa (patch)
tree8950d27e708ac8f0451f14c94c8cf76b0ce15877 /src/Common/RequestManager.h
parent4cd88a87e66dbbb9be4137de04ad79c97ac5bf2c (diff)
downloadmad-1508969d508e41de824d1d1227be708136760cfa.tar
mad-1508969d508e41de824d1d1227be708136760cfa.zip
Request-Verarbeitung ?berarbeitet
Diffstat (limited to 'src/Common/RequestManager.h')
-rw-r--r--src/Common/RequestManager.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h
index a5861dd..fde8f3e 100644
--- a/src/Common/RequestManager.h
+++ b/src/Common/RequestManager.h
@@ -20,7 +20,7 @@
#ifndef MAD_COMMON_REQUESTMANAGER_H_
#define MAD_COMMON_REQUESTMANAGER_H_
-#include "RequestInfo.h"
+#include "Request/Request.h"
#include <Net/Connection.h>
#include <map>
@@ -29,7 +29,29 @@ namespace Common {
class RequestManager {
private:
- typedef std::map<unsigned short,RequestInfo> RequestMap;
+ class RequestMap : private std::map<unsigned short,Request::Request*> {
+ public:
+ ~RequestMap() {
+ for(iterator it = begin(); it != end(); ++it)
+ delete it->second;
+ }
+
+ bool addRequest(unsigned short id, Request::Request *info) {
+ return insert(std::make_pair(id, info)).second;
+ }
+
+ Request::Request* findRequest(unsigned short id) {
+ iterator it = find(id);
+ if(it == end())
+ return 0;
+
+ return it->second;
+ }
+
+ bool deleteRequest(unsigned short id) {
+ return erase(id);
+ }
+ };
std::map<Net::Connection*,RequestMap> requestMap;
unsigned short requestId;
@@ -51,7 +73,7 @@ class RequestManager {
requestMap.erase(connection);
}
- bool sendRequest(Net::Connection *connection, RequestInfo requestData);
+ bool sendRequest(Net::Connection *connection, Request::Request *request);
RequestManager() : requestId(0) {}