BESSetContextCommand.cc
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 #include "BESSetContextCommand.h"
00034 #include "BESTokenizer.h"
00035 #include "BESResponseHandlerList.h"
00036 #include "BESContainerStorageList.h"
00037 #include "BESSyntaxUserError.h"
00038 #include "BESDataNames.h"
00039 #include "BESResponseNames.h"
00040
00057 BESResponseHandler *
00058 BESSetContextCommand::parse_request( BESTokenizer &tokenizer,
00059 BESDataHandlerInterface &dhi )
00060 {
00061 string my_token ;
00062
00063
00064
00065 dhi.action = SET_CONTEXT ;
00066 BESResponseHandler *retResponse =
00067 BESResponseHandlerList::TheList()->find_handler( SET_CONTEXT ) ;
00068 if( !retResponse )
00069 {
00070 string s = (string)"No response handler for command " + SET_CONTEXT ;
00071 throw BESSyntaxUserError( s, __FILE__, __LINE__ ) ;
00072 }
00073
00074
00075 my_token = tokenizer.get_next_token() ;
00076 if( my_token == ";" )
00077 {
00078 tokenizer.parse_error( my_token + " not expected\n" ) ;
00079 }
00080 dhi.data[CONTEXT_NAME] = my_token ;
00081
00082
00083 my_token = tokenizer.get_next_token() ;
00084 if( my_token != "to" )
00085 {
00086 tokenizer.parse_error( my_token + " not expected\n" ) ;
00087 }
00088
00089
00090 my_token = tokenizer.get_next_token() ;
00091 if( my_token == ";" )
00092 {
00093 tokenizer.parse_error( my_token + " not expected\n" ) ;
00094 }
00095 dhi.data[CONTEXT_VALUE] = my_token ;
00096
00097
00098 my_token = tokenizer.get_next_token() ;
00099 if( my_token != ";" )
00100 {
00101 tokenizer.parse_error( my_token + " not expected\n" ) ;
00102 }
00103
00104 return retResponse ;
00105 }
00106
00113 void
00114 BESSetContextCommand::dump( ostream &strm ) const
00115 {
00116 strm << BESIndent::LMarg << "BESSetContextCommand::dump - ("
00117 << (void *)this << ")" << endl ;
00118 BESIndent::Indent() ;
00119 BESCommand::dump( strm ) ;
00120 BESIndent::UnIndent() ;
00121 }
00122