X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fcommand_server.hxx;h=3c0026267a33f9221cd171620d4f47c6144c3664;hp=192673366d98497be8de56c61a66124f9668a1ff;hb=539b09c0c1819f9394e5a0ae8b3df3687715fa7c;hpb=01a464637ed95b0aacd58eb74bdd17df4a7851ab diff --git a/src/command_server.hxx b/src/command_server.hxx index 1926733..3c00262 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,24 @@ 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; } +}; + +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