OPeNDAP Hyrax Back End Server (BES) Updated for version 3.8.3
|
00001 // CmdTranslation.h 00002 00003 // This file is part of bes, A C++ back-end server implementation framework 00004 // for the OPeNDAP Data Access Protocol. 00005 00006 // Copyright (c) 2004-2009 University Corporation for Atmospheric Research 00007 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu> 00008 // 00009 // This library is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License as published by the Free Software Foundation; either 00012 // version 2.1 of the License, or (at your option) any later version. 00013 // 00014 // This library is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with this library; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 // You can contact University Corporation for Atmospheric Research at 00024 // 3080 Center Green Drive, Boulder, CO 80301 00025 00026 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005 00027 // Please read the full copyright statement in the file COPYRIGHT_UCAR. 00028 // 00029 // Authors: 00030 // pwest Patrick West <pwest@ucar.edu> 00031 // jgarcia Jose Garcia <jgarcia@ucar.edu> 00032 00033 #ifndef CmdTranslation_h 00034 #define CmdTranslation_h 1 00035 00036 #include <libxml/encoding.h> 00037 #include <libxml/xmlwriter.h> 00038 00039 #include <string> 00040 #include <map> 00041 #include <iostream> 00042 00043 using std::string ; 00044 using std::map ; 00045 using std::ostream ; 00046 00047 class BESTokenizer ; 00048 00049 class CmdTranslation 00050 { 00051 private: 00052 typedef bool (*p_cmd_translator)( BESTokenizer &tokenizer, 00053 xmlTextWriterPtr writer ) ; 00054 static map< string, p_cmd_translator > _translations ; 00055 00056 static bool _is_show ; 00057 00058 static bool translate_show( BESTokenizer &tokenizer, 00059 xmlTextWriterPtr writer ) ; 00060 static bool translate_show_error( BESTokenizer &tokenizer, 00061 xmlTextWriterPtr writer ) ; 00062 static bool translate_catalog( BESTokenizer &tokenizer, 00063 xmlTextWriterPtr writer ) ; 00064 static bool translate_set( BESTokenizer &tokenizer, 00065 xmlTextWriterPtr writer ) ; 00066 static bool translate_context( BESTokenizer &tokenizer, 00067 xmlTextWriterPtr writer ) ; 00068 static bool translate_container( BESTokenizer &tokenizer, 00069 xmlTextWriterPtr writer ) ; 00070 static bool translate_define( BESTokenizer &tokenizer, 00071 xmlTextWriterPtr writer ) ; 00072 static bool translate_delete( BESTokenizer &tokenizer, 00073 xmlTextWriterPtr writer ) ; 00074 static bool translate_get( BESTokenizer &tokenizer, 00075 xmlTextWriterPtr writer ) ; 00076 00077 static bool do_translate( BESTokenizer &tokenizer, 00078 xmlTextWriterPtr writer ) ; 00079 public: 00080 static int initialize( int argc, char **argv ) ; 00081 static int terminate( void ) ; 00082 00083 static bool is_show() { return _is_show ; } 00084 static void set_show( bool val ) { _is_show = val ; } 00085 00086 static void add_translation( const string &name, 00087 p_cmd_translator func ) ; 00088 static void remove_translation( const string &name ) ; 00089 00090 static string translate( const string &commands ) ; 00091 00092 static void dump( ostream &strm ) ; 00093 } ; 00094 00095 #endif // CmdTranslation_h 00096