00001
00002
00003
00004
00005 #ifndef EQNET_COMMANDFUNC_H
00006 #define EQNET_COMMANDFUNC_H
00007
00008 #include <eq/net/commandResult.h>
00009
00010 namespace eq
00011 {
00012 namespace net
00013 {
00014 class Command;
00015
00016 template< typename T > class CommandFunc
00017 {
00018 public:
00019 CommandFunc( T* object,
00020 CommandResult (T::*func)( Command& ))
00021 : _object( object ), _func( func ) {}
00022
00023 template< typename O > CommandFunc( const O& from )
00024 : _object( from._object ),
00025 _func(
00026 static_cast<CommandResult (T::*)( Command& )>(from._func))
00027 {}
00028
00029 CommandResult operator()( Command& command )
00030 {
00031 return (_object->*_func)( command );
00032 }
00033
00034
00035
00036
00037
00038 T* _object;
00039 CommandResult (T::*_func)( Command& );
00040 };
00041 }
00042 }
00043
00044 #endif //EQNET_COMMANDFUNC_H