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 class ParamWrapper;
00041 class LoadFunctionElement;
00042 
00043 XERCES_CPP_NAMESPACE_USE
00044 using namespace std;
00045 
00046 class InputHandler : public XMLHandler 
00047 {
00048                 
00049         private:
00050                 int     argc;
00051                 char**  argv;
00052                 bool    isXML;
00053 
00054                 DOMElement      *rootElem, *greenElem, *loadElem, *kernelElem;
00055 
00056                 void readCommandline();
00057                 void initDOM();
00058                 string getAttributeValue(const XMLCh* parentNode, const XMLCh* elementNode, const XMLCh* elementName);
00059                 string getAttributeValueByName(const XMLCh* elementNode, const XMLCh* elementName, const XMLCh* name);
00060                 void initParamsFromDOM(DOMNode *node, multimap<string, ParamWrapper*>);
00061                 void initParamsFromDOMNodeList(DOMNodeList* , map< unsigned int, multimap<string, ParamWrapper*> >);
00062                 bool jobExists(string);
00063 
00065                 InputHandler(const InputHandler& x); 
00066                         
00067         public:
00068                 InputHandler(int, char**);      /*Constructor*/
00069                 ~InputHandler();                /*Destructor */
00070 
00071                 void init();
00072                 void initParamsFromDOM();
00073                 
00074                 /*GETTERS*/
00075                 /*********/
00076 //              string getGreenPlugin();
00077                 map<string, string> getGreenJobMap();
00078                 string getGreenPlugin(string);
00079                 string getLoadPlugin();
00080                 string getLoadPlugin(string);
00081 //              string getLoadHistoryPlugin();
00082                 string getLoadHistoryPlugin(string);
00083 //              string getCrustalDecayPlugin();
00084                 string getCrustalDecayPlugin(string);
00085                 string getKernelPlugin();
00086                 string getKernelPlugin(string);
00087                 string getOutputPlugin();
00088                 string getOutputPlugin(string);
00089                 string getFileName(string type);
00090                 string getResultFileName();
00091                 int    getRegion(string direction);
00092                 int    getGridSize();
00093                 unsigned long int getTimeSteps();
00094         unsigned long int getTimeIncrement();
00095                 DOMNode* getExperiment();
00096                 list<string> getPostProcessorNameList();
00097         list<LoadFunctionElement*> getLoadFunctionList();
00098 
00099                 /*SETTERS*/
00100                 /*********/
00101                 void setXML(bool b){/*isXML = b;*/}
00102                 void setList(bool b){/*doList = b;*/}
00103 };
00104 
00105 #endif // _input_handler_h

Generated on Sun Aug 31 13:18:59 2008 for CrusDe by  doxygen 1.5.0