BESCommand.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef A_BESCommand_h
00034 #define A_BESCommand_h 1
00035
00036 #include <string>
00037 #include <map>
00038
00039 using std::string ;
00040 using std::map ;
00041
00042 #include "BESObj.h"
00043 #include "BESDataHandlerInterface.h"
00044
00045 class BESResponseHandler ;
00046 class BESTokenizer ;
00047
00048 class BESCommand : public BESObj
00049 {
00050 private:
00051 static map< string, BESCommand * > cmd_list ;
00052 typedef map< string, BESCommand * >::iterator cmd_iter ;
00053 protected:
00054 string _cmd ;
00055 public:
00056 BESCommand( const string &cmd )
00057 : _cmd( cmd ) {}
00058 virtual ~BESCommand() {}
00059
00060 virtual string parse_options( BESTokenizer &tokens,
00061 BESDataHandlerInterface &dhi ) ;
00062
00063 virtual BESResponseHandler *parse_request( BESTokenizer &tokens,
00064 BESDataHandlerInterface &dhi ) = 0 ;
00065
00066 virtual void dump( ostream &strm ) const ;
00067
00068 static BESCommand * TermCommand ;
00069 static void add_command( const string &cmd_str,
00070 BESCommand *cmd ) ;
00071 static bool del_command( const string &cmd_str ) ;
00072 static BESCommand * find_command( const string &cmd_str ) ;
00073 } ;
00074
00075 #endif // A_BESCommand_h
00076