TDME2  1.9.200
ServerClientRequestHandler.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <tdme/tdme.h>
4 
5 #include <string>
6 
7 using std::string;
8 
9 namespace tdme {
10 namespace network {
11 namespace udpserver {
12 
13 /**
14  * @brief Network client request handler base class
15  * @author Andreas Drewke
16  */
17 template <class CLIENT, class REQUEST>
19 public:
20  // forbid class copy
22 
23  /**
24  * @brief Public constructor
25  */
26  ServerClientRequestHandler(const std::string& command) {
27  this->command = command;
28  }
29 
30  /**
31  * @brief Public destructor
32  */
34  }
35 
36  /**
37  * @brief Returns this requests handler command name
38  */
39  inline const string& getCommand() {
40  return command;
41  }
42 
43  /**
44  * @brief Request handler implementation
45  * @param client client
46  * @param request request data
47  * @param messageId message id (udp server only)
48  * @param retries retries (udp server only)
49  */
50  virtual void handleRequest(CLIENT* client, REQUEST& request, const uint32_t messageId, const uint8_t retries) = 0;
51 private:
52  string command;
53 };
54 
55 };
56 };
57 };
virtual void handleRequest(CLIENT *client, REQUEST &request, const uint32_t messageId, const uint8_t retries)=0
Request handler implementation.
const string & getCommand()
Returns this requests handler command name.
Definition: fwd-tdme.h:4
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6