Command.cc

Go to the documentation of this file.
00001 // OPENDAP_CLASSOPENDAP_COMMANDCommand.cc
00002 
00003 #include "OPENDAP_CLASSOPENDAP_COMMANDCommand.h"
00004 #include "BESTokenizer.h"
00005 #include "BESResponseHandlerList.h"
00006 #include "BESParserException.h"
00007 #include "OPENDAP_CLASSResponseNames.h"
00008 
00009 BESResponseHandler *
00010 OPENDAP_CLASSOPENDAP_COMMANDCommand::parse_request( BESTokenizer &tokenizer,
00011                                            BESDataHandlerInterface &dhi )
00012 {
00013     string my_token ;
00014 
00015     /* No sub command, so proceed with the default command
00016      */
00017     dhi.action = OPENDAP_MACRO_RESPONSE ;
00018     BESResponseHandler *retResponse =
00019         BESResponseHandlerList::TheList()->find_handler( OPENDAP_MACRO_RESPONSE ) ;
00020     if( !retResponse )
00021     {
00022         string s = (string)"No response handler for command " + OPENDAP_MACRO_RESPONSE ;
00023         throw BESParserException( s, __FILE__, __LINE__ ) ;
00024     }
00025 
00026     my_token = tokenizer.get_next_token() ;
00027     if( my_token == ";" )
00028     {
00029         tokenizer.parse_error( my_token + " not expected\n" ) ;
00030     }
00031 
00032     // Here is where your code would parse the tokens
00033 
00034     // Last token should be the terminating semicolon (;)
00035     my_token = tokenizer.get_next_token() ;
00036     if( my_token != ";" )
00037     {
00038         tokenizer.parse_error( my_token + " not expected\n" ) ;
00039     }
00040 
00041     return retResponse ;
00042 }
00043 
00050 void
00051 OPENDAP_CLASSOPENDAP_COMMANDCommand::dump( ostream &strm ) const
00052 {
00053     strm << BESIndent::LMarg << "OPENDAP_CLASSOPENDAP_COMMANDCommand::dump - ("
00054                              << (void *)this << ")" << endl ;
00055     BESIndent::Indent() ;
00056     BESCommand::dump( strm ) ;
00057     BESIndent::UnIndent() ;
00058 }
00059 

Generated on Sat Jan 19 04:05:37 2008 for OPeNDAP Back End Server (BES) by  doxygen 1.5.4