Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

boss_config.h

Go to the documentation of this file.
00001 /* boss_config.cpp    $Revision: 1.5 $ $Date: 2005/12/17 16:06:11 $
00002    Copyright (C) 1998 University of Bonn.
00003    http://www.ikp.uni-bonn.de/boss
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU General Public License
00007    as published by the Free Software Foundation; either version 2
00008    of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA  02111-1307, USA.
00019 */
00020 
00021 
00022 
00023 #ifndef __BOSSCONFIGH__
00024 #define __BOSSCONFIGH__
00025 
00026 #include <iostream>
00027 #include <vector>
00028 #include <map>
00029 #include <list>
00030 #include <algorithm>
00031 #include <string>
00032 #include <fstream>
00033 #include <sstream>
00034 
00035 #include "xercesc/dom/DOM.hpp"
00036 #include "xercesc/util/XMLString.hpp"
00037 #include "xercesc/util/PlatformUtils.hpp"
00038 
00039 #include "boss_utility/boss_types.h"
00040 #include "boss_utility/boss_optitem.h"
00041 #include "boss_utility/dom_tools.h"
00042 
00043 using namespace std;
00044 
00045 
00046 
00047 namespace BOSS
00048 {
00049 class Config
00050 {
00051   typedef vector< string >      t_StringVector;
00052   typedef list< string >        t_StringList;
00053   typedef map< string, t_OptItem> t_OptMap;
00054   typedef pair< string, t_OptMap *> t_InvPair;
00055   typedef map< string, t_InvPair> t_InvMap;
00056   
00057  protected:
00058   
00060   t_SVector farg;
00061   
00063   string         usage;
00064   string         defInv;
00065   string         currInv;
00066   string         currLang;
00067   t_InvMap       invMap;
00068   t_OptMap *     currOptMap;
00069   t_SVector invVec;
00070 
00071   void error(const string & s);
00072 
00073   bool fileExists(string & file);
00074   string getConfPath(t_StringList & h, string file);
00075   void readXMLConfig(const string & file);
00076   bool procInvPrefix(string & arg);
00077   
00078  public:
00079 
00080   Config() { ; }
00081 
00082   Config(Config & cl) { ; }
00083 
00084   Config(int argc, char ** argv, const string & s);
00085 
00086   void print(ostream & s) const;
00087 
00088   Config & operator = (const Config & C);
00089 
00090   t_OptItem operator () (string opt) const;
00091 
00092   string operator [] (const unsigned i) const;
00093   
00094   unsigned size() const { return farg.size(); }
00095 
00096   bool setInv( const string & inv);
00097 
00098   string getInvName() { return currInv; };
00099   
00100   bool setInvtoDef();
00101 
00102   string getDefInv() { return defInv; };
00103   
00104   string getLang() { return currLang; };
00105   
00106   t_SVector listInv() { return invVec; };
00107 
00108   t_SVector * listInvPtr() { cout << "BOSS::Config::listInvPtr: invVec.size() = " << invVec.size() << endl; return &invVec; };
00109 };
00110 }
00111 #endif

Generated on Tue Dec 20 23:14:37 2005 for BOSS by doxygen 1.3.6