InputHandler.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * File: ./InputHandler.h 00003 * Author: Ronni Grapenthin, NORVULK & HU-BERLIN 00004 * Created: 20.02.2007 00005 * Licence: GPLv2 00006 * 00007 * ######################################################################### 00008 * 00009 * CrusDe, simulation framework for crustal deformation studies 00010 * Copyright (C) 2007 Ronni Grapenthin 00011 * 00012 * This program is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU General Public License 00014 * as published by the Free Software Foundation; version 2 00015 * of the License. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00025 * 00026 ****************************************************************************/ 00027 00028 #ifndef _input_handler_h 00029 #define _input_handler_h 00030 00031 #include "XMLHandler.h" 00032 #include <xercesc/dom/DOMElement.hpp> 00033 00034 #include <iostream> 00035 #include <cassert> 00036 #include <string> 00037 #include <stdexcept> 00038 #include <map> 00039 00040 XERCES_CPP_NAMESPACE_USE 00041 using namespace std; 00042 00043 class InputHandler : public XMLHandler 00044 { 00045 00046 private: 00047 int argc; 00048 char** argv; 00049 bool isXML, doList; 00050 00051 DOMElement *rootElem, *greenElem, *loadElem, *kernelElem; 00052 00053 void listOptions(){}; 00054 void readCommandline(); 00055 void initDOM(); 00056 string getAttributeValue(const XMLCh* parentNode, const XMLCh* elementNode, const XMLCh* elementName); 00057 string getAttributeValueByName(const XMLCh* elementNode, const XMLCh* elementName, const XMLCh* name); 00058 void initParamsFromDOM(DOMNode *node, multimap<string, double*>); 00059 void resolveParamNamesInDOM(DOMNode *node, multimap<string, double*>); 00060 void addParamToDOM(DOMElement *node, string name, string value); 00061 void addPluginToDOM(DOMElement *node, string name); 00062 00064 InputHandler(const InputHandler& x); 00065 00066 public: 00067 InputHandler(int, char**); /*Constructor*/ 00068 ~InputHandler(); /*Destructor */ 00069 00070 void init(); 00071 void initParamsFromDOM(); 00072 00073 /*GETTERS*/ 00074 /*********/ 00075 string getGreenPlugin(); 00076 string getGreenPlugin(string); 00077 string getLoadPlugin(); 00078 string getLoadPlugin(string); 00079 string getLoadHistoryPlugin(); 00080 string getLoadHistoryPlugin(string); 00081 string getKernelPlugin(); 00082 string getKernelPlugin(string); 00083 string getOutputPlugin(); 00084 string getOutputPlugin(string); 00085 string getFileName(string type); 00086 string getResultFileName(); 00087 int getRegion(string direction); 00088 int getGridSize(); 00089 int getTimeSteps(); 00090 DOMNode* getExperiment(); 00091 list<string> getPostProcessorNameList(); 00092 00093 /*SETTERS*/ 00094 /*********/ 00095 void setXML(bool b){/*isXML = b;*/} 00096 void setList(bool b){/*doList = b;*/} 00097 }; 00098 00099 #endif // _input_handler_h

Generated on Sun Jul 29 08:17:23 2007 for CrusDe by doxygen 1.3.8