X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fcommand_server.hxx;h=c86b2858da60948e8db2c0d068cf753c01acbd3a;hp=192673366d98497be8de56c61a66124f9668a1ff;hb=a762a4763df16c8e38afe727921273cd929709a4;hpb=45a2ebc9695c4d7be6548b7e0f800d117ae56a0b diff --git a/src/command_server.hxx b/src/command_server.hxx index 1926733..c86b285 100644 --- a/src/command_server.hxx +++ b/src/command_server.hxx @@ -19,6 +19,7 @@ #ifndef __LIBT2N_COMMAND_SERVER #define __LIBT2N_COMMAND_SERVER +#include "command.hxx" #include "server.hxx" namespace libt2n @@ -32,6 +33,10 @@ class command_server void handle_packet(const std::string& packet, server_connection* conn); + protected: + virtual command* cast_command(command* input) + { return input; } + public: command_server(server& _s); @@ -40,7 +45,25 @@ class command_server void send_hello(unsigned int conn_id); }; -} +template struct Derived_from { + static void constraints(T* p) { B* pb = p; } + Derived_from() { void(*p)(T*) = constraints; } +}; + +/// server handling group of incoming commands +template +class group_command_server : public command_server +{ + private: + virtual command* cast_command(command* input) + { return dynamic_cast(input); } + public: + group_command_server(server& _s) + : command_server(_s) + { Derived_from(); } +}; + +} #endif