Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

configurationdatabase.h

Go to the documentation of this file.
00001 /***************************************************************************************************
00002 *****           Copyright (C) 2005  John Schneiderman <JohnMS@member.fsf.org>                  *****
00003 *****                                                                                          *****
00004 *****           This program is free software; you can redistribute it and/or modify           *****
00005 *****           it under the terms of the GNU General Public License as published by           *****
00006 *****           the Free Software Foundation; either version 2 of the License, or              *****
00007 *****           (at your option) any later version.                                            *****
00008 *****                                                                                          *****
00009 *****           This program is distributed in the hope that it will be useful,                *****
00010 *****           but WITHOUT ANY WARRANTY; without even the implied warranty of                 *****
00011 *****           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                  *****
00012 *****           GNU General Public License for more details.                                   *****
00013 *****                                                                                          *****
00014 *****           You should have received a copy of the GNU General Public License              *****
00015 *****           along with this program; if not, write to the Free Software                    *****
00016 *****           Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA     *****
00017 ***************************************************************************************************/
00018 #ifndef CONFIGURATION_DATABASE_H_
00019 #define CONFIGURATION_DATABASE_H_
00020 
00021 #include <map>
00022 using std::map;
00023 
00024 #include <vector>
00025 using std::vector;
00026 
00027 #include <iterator>
00028 using std::iterator;
00029 
00030 #include <iostream>
00031 using std::istream;
00032 using std::ostream;
00033 
00034 #include <string>
00035 using std::string;
00036 
00046 class ConfigurationDatabase
00047 {
00048 public:
00053     typedef map<string, string> KeyValuePair;
00058     typedef map<string, KeyValuePair> ConfigurationDatabaseType;
00060     typedef vector<string> Keys;
00062     typedef vector<string> Headers;
00063 
00067     ConfigurationDatabase();
00073     ConfigurationDatabase(const string &filename);
00081     int intValue(const string &header, const string &key) const;
00089     double doubleValue(const string &header, const string &key) const;
00097     string stringValue(const string &header, const string &key) const;
00102     Headers headers() const;
00108     Keys keys(const string &header) const;
00115     void addHeaderKeyValuePair(const string &header, const string &key, const string &value);
00123     void addKeyValuePair(const string &header, const string &key, const string &value);
00134     friend istream& operator>>(istream &in, ConfigurationDatabase &database);
00143     friend ostream& operator<<(ostream &out, const ConfigurationDatabase &database);
00144 
00145 private:
00147     ConfigurationDatabaseType m_configurations;
00153     map<int, string> m_comments;
00155     static const char BEGIN_COMMENT;
00157     static const char BEGIN_HEADER;
00159     static const char END_HEADER;
00160 };
00161 #endif

Generated on Tue Mar 28 23:28:03 2006 for ClusterSim by  doxygen 1.4.4