Go to the documentation of this file.
46 SectionTable::iterator
i = table.begin();
47 SectionTable::iterator end = table.end();
58 ifstream
f(file.c_str());
77 const std::string &value,
80 EntryTable::iterator ei = table.find(entryName);
82 if (ei == table.end()) {
84 table[entryName] =
new Entry(value);
88 ei->second->appendValue(value);
92 ei->second->setValue(value);
101 if (
offset == string::npos) {
103 cerr <<
"Can't parse .ini line " << assignment << endl;
108 bool append = (assignment[
offset-1] ==
'+');
110 string entryName = assignment.substr(0, append ?
offset-1 :
offset);
111 string value = assignment.substr(
offset + 1);
116 addEntry(entryName, value, append);
126 EntryTable::const_iterator ei = table.find(entryName);
128 return (ei == table.end()) ? NULL : ei->second;
135 SectionTable::iterator
i = table.find(sectionName);
137 if (
i != table.end()) {
143 table[sectionName] = sec;
152 SectionTable::const_iterator
i = table.find(sectionName);
154 return (
i == table.end()) ? NULL :
i->second;
165 if (
offset == string::npos)
168 string sectionName = str.substr(0,
offset);
169 string rest = str.substr(
offset + 1);
172 Section *
s = addSection(sectionName);
180 Section *section = NULL;
190 if (line.size() == 0)
194 int last = line.size() - 1;
196 if (line[0] ==
'[' && line[last] ==
']') {
197 string sectionName = line.substr(1, last - 1);
199 section = addSection(sectionName);
206 if (!section->add(line))
217 Section *section = findSection(sectionName);
233 Section *section = findSection(sectionName);
244 return findSection(sectionName) != NULL;
252 bool search_unref_entries =
false;
255 Entry *entry = findEntry(
"unref_entries_ok");
258 if (unref_ok_entries.size()) {
259 search_unref_entries =
true;
263 for (EntryTable::iterator ei = table.begin();
264 ei != table.end(); ++ei) {
265 const string &entryName = ei->first;
268 if (entryName ==
"unref_section_ok" ||
269 entryName ==
"unref_entries_ok")
275 if (search_unref_entries &&
276 (std::find(unref_ok_entries.begin(), unref_ok_entries.end(),
277 entryName) != unref_ok_entries.end()))
282 cerr <<
"Parameter " << sectionName <<
":" << entryName
283 <<
" not referenced." << endl;
295 for (SectionTable::const_iterator
i = table.begin();
296 i != table.end(); ++
i)
298 list.push_back((*i).first);
307 for (SectionTable::iterator
i = table.begin();
308 i != table.end(); ++
i) {
309 const string §ionName =
i->first;
313 if (section->
findEntry(
"unref_section_ok") == NULL) {
314 cerr <<
"Section " << sectionName <<
" not referenced."
333 for (EntryTable::iterator ei = table.begin();
334 ei != table.end(); ++ei) {
335 cout << sectionName <<
": " << (*ei).first <<
" => "
336 << (*ei).second->getValue() <<
"\n";
343 for (SectionTable::iterator
i = table.begin();
344 i != table.end(); ++
i) {
345 i->second->dump(
i->first);
void tokenize(vector< string > &v, const string &s, char token, bool ignore)
bool printUnreferenced()
Print unreferenced entries in object.
void eat_end_white(std::string &s)
void getSectionNames(std::vector< std::string > &list) const
Push all section names into the given vector.
void addEntry(const std::string &entryName, const std::string &value, bool append)
Add an entry to the table.
bool find(const std::string §ion, const std::string &entry, std::string &value) const
Find value corresponding to given section and entry names.
bool entryExists(const std::string §ion, const std::string &entry) const
Determine whether the entry exists within named section exists in the .ini file.
void dump(const std::string §ionName)
Print the contents of this section to cout (for debugging).
bool add(const std::string &s)
Take string of the form "<section>:<parameter>=<value>" or "<section>:<parameter>+=<value>" and add t...
bool add(const std::string &assignment)
Add an entry to the table given a string assigment.
Entry * findEntry(const std::string &entryName) const
Find the entry with the given name.
bool printUnreferenced(const std::string §ionName)
Print the unreferenced entries in this section to cerr.
Section * addSection(const std::string §ionName)
Look up section with the given name, creating a new section if not found.
void eat_white(std::string &s)
Overload hash function for BasicBlockRange type.
bool isReferenced()
Has this entry been used?
bool load(std::istream &f)
Load parameter settings from given istream.
Section * findSection(const std::string §ionName) const
Look up section with the given name.
bool isReferenced()
Has this section been used?
bool sectionExists(const std::string §ion) const
Determine whether the named section exists in the .ini file.
const std::string & getValue() const
Fetch the value.
void dump()
Dump contents to cout. For debugging.
Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17