RawOptionsContainer.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP 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
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: martin.riedel@tuebingen.mpg.de
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00027 #ifndef __RAWOPTIONSCONTAINER_H__
00028 #define __RAWOPTIONSCONTAINER_H__
00029 
00030 // MIP
00031 #include "LogTrace.h"
00032 
00033 // STL
00034 #include <map>
00035 #include <string>
00036 #include <iostream>
00037 #include <sstream>
00038 
00039 
00040 using namespace std;
00041 
00042 typedef map<string, string> StringMap;
00043 
00044 class RawOptionsContainer : public MIPObject {
00045 protected:
00046  static StringMap rawOptionsMap;
00047  static bool addUpdateDashOption(string dashkey, const string& value, bool overwrite, bool showDashError = false);
00048 
00049 public:
00050  // Checking
00051  static bool hasOption(const string& key);
00052  // Manipulation
00053  static bool removeOption(const string& key);
00054  static bool getOption(const string& key, string& value);
00055  // Option must exist
00056  static bool updateOption(const string& key, const string& value);
00057  // Option must NOT exist
00058  static bool addOption(const string& key, const string& value);
00059  // Value gets set whether option exists or not
00060  static void addUpdateOption(const string& key, const string& value);
00061 
00062  // parse CommandLine Arguments.
00063  static bool parseCommandLine(int argc, char* const argv[], bool overwrite = false);
00064  // parse File
00065  static bool parseFile(const string& fileName, bool overwrite = false);
00066 
00067  // be careful with this.
00068  static void clearOptions();
00069 
00070  static void print();
00071  static string toString();
00072 
00073  // Get Reference to StringMap
00074  static StringMap& getMap();
00075 
00076 };
00077 
00078 #endif /* OPTIONSCONTAINER_H_ */

Generated on Mon Feb 20 07:01:07 2017 for MIP by  doxygen 1.5.6