diff --git a/src/base/inifile.cc b/src/base/inifile.cc index 402c6469f..80ed3eb06 100644 --- a/src/base/inifile.cc +++ b/src/base/inifile.cc @@ -229,6 +229,17 @@ IniFile::find(const string §ionName, const string &entryName, return true; } +bool +IniFile::entryExists(const string §ionName, const string &entryName) const +{ + Section *section = findSection(sectionName); + + if (!section) + return false; + else + return section->findEntry(entryName); +} + bool IniFile::sectionExists(const string §ionName) const { diff --git a/src/base/inifile.hh b/src/base/inifile.hh index b4892d60a..447ec7c0f 100644 --- a/src/base/inifile.hh +++ b/src/base/inifile.hh @@ -184,6 +184,12 @@ class IniFile bool find(const std::string §ion, const std::string &entry, std::string &value) const; + /// Determine whether the entry exists within named section exists + /// in the .ini file. + /// @return True if the section exists. + bool entryExists(const std::string §ion, + const std::string &entry) 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 diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc index e55107b79..d2e699c28 100644 --- a/src/sim/serialize.cc +++ b/src/sim/serialize.cc @@ -692,6 +692,12 @@ CheckpointIn::~CheckpointIn() delete db; } +bool +CheckpointIn::entryExists(const string §ion, const string &entry) +{ + return db->entryExists(section, entry); +} + bool CheckpointIn::find(const string §ion, const string &entry, string &value) { diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh index 2f0340e4b..4c5e9d79c 100644 --- a/src/sim/serialize.hh +++ b/src/sim/serialize.hh @@ -359,6 +359,8 @@ class CheckpointIn bool findObj(const std::string §ion, const std::string &entry, SimObject *&value); + + bool entryExists(const std::string §ion, const std::string &entry); bool sectionExists(const std::string §ion); // The following static functions have to do with checkpoint