Print a warning rather than failing if we're unserializing and there's an
object in the config that was not in the checkpointed config. This code compiles, but I haven't tested it... I'm committing it so Ron can have it. Should not effect anything that currently works. base/inifile.cc: base/inifile.hh: Add sectionExists() method so you can query whether a section exists without knowing any of the entry names that would be in it. sim/serialize.cc: sim/serialize.hh: Add Checkpoint::sectionExists() (pass through to IniFile). --HG-- extra : convert_revision : 905db122afdfe55946ab8493ccac0b1e715bc7c6
This commit is contained in:
parent
34c8821970
commit
2ac054386d
4 changed files with 24 additions and 0 deletions
|
@ -402,6 +402,14 @@ IniFile::findAppend(const string &_section, const string &entry,
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
IniFile::sectionExists(const string §ionName) const
|
||||
{
|
||||
return findSection(sectionName) != NULL;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
IniFile::Section::printUnreferenced(const string §ionName)
|
||||
{
|
||||
|
|
|
@ -208,6 +208,13 @@ class IniFile
|
|||
bool findAppend(const std::string §ion, const std::string &entry,
|
||||
std::string &value) const;
|
||||
|
||||
/// Determine whether the named section exists in the .ini file.
|
||||
/// Note that the 'Section' class is (intentionally) not public,
|
||||
/// so all clients can do is get a bool that says whether there
|
||||
/// are any values in that section or not.
|
||||
/// @return True if the section exists.
|
||||
bool sectionExists(const std::string §ion) const;
|
||||
|
||||
/// Print unreferenced entries in object. Iteratively calls
|
||||
/// printUnreferend() on all the constituent sections.
|
||||
bool printUnreferenced();
|
||||
|
|
|
@ -494,3 +494,10 @@ Checkpoint::findObj(const std::string §ion, const std::string &entry,
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Checkpoint::sectionExists(const std::string §ion)
|
||||
{
|
||||
return db->sectionExists(section);
|
||||
}
|
||||
|
|
|
@ -244,6 +244,8 @@ class Checkpoint
|
|||
|
||||
bool findObj(const std::string §ion, const std::string &entry,
|
||||
Serializeable *&value);
|
||||
|
||||
bool sectionExists(const std::string §ion);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue