Remove unused method from the Schema class
nodeExists is only used in StaticSchema, so no reason to have it in
the interface class.
Change-Id: I8426bdb27b36a035fb0685501fa8723c71473589
diff --git a/src/schema.hpp b/src/schema.hpp
index 6a2240d..87feeaa 100644
--- a/src/schema.hpp
+++ b/src/schema.hpp
@@ -88,7 +88,6 @@
virtual bool leafEnumHasValue(const schemaPath_& location, const ModuleNodePair& node, const std::string& value) const = 0;
virtual bool leafIdentityIsValid(const schemaPath_& location, const ModuleNodePair& node, const ModuleValuePair& value) const = 0;
virtual bool listHasKey(const schemaPath_& location, const ModuleNodePair& node, const std::string& key) const = 0;
- virtual bool nodeExists(const std::string& location, const std::string& node) const = 0;
virtual const std::set<std::string> listKeys(const schemaPath_& location, const ModuleNodePair& node) const = 0;
virtual yang::LeafDataTypes leafType(const schemaPath_& location, const ModuleNodePair& node) const = 0;
virtual const std::set<std::string> validIdentities(const schemaPath_& location, const ModuleNodePair& node, const Prefixes prefixes) const = 0;
diff --git a/src/static_schema.hpp b/src/static_schema.hpp
index 3bf60f0..3071e4c 100644
--- a/src/static_schema.hpp
+++ b/src/static_schema.hpp
@@ -31,7 +31,6 @@
bool leafEnumHasValue(const schemaPath_& location, const ModuleNodePair& node, const std::string& value) const override;
bool leafIdentityIsValid(const schemaPath_& location, const ModuleNodePair& node, const ModuleValuePair& value) const override;
bool listHasKey(const schemaPath_& location, const ModuleNodePair& node, const std::string& key) const override;
- bool nodeExists(const std::string& location, const std::string& node) const override;
const std::set<std::string> listKeys(const schemaPath_& location, const ModuleNodePair& node) const override;
yang::LeafDataTypes leafType(const schemaPath_& location, const ModuleNodePair& node) const override;
const std::set<std::string> enumValues(const schemaPath_& location, const ModuleNodePair& node) const override;
@@ -49,6 +48,7 @@
private:
const std::unordered_map<std::string, NodeType>& children(const std::string& name) const;
void getIdentSet(const ModuleValuePair& ident, std::set<ModuleValuePair>& res) const;
+ bool nodeExists(const std::string& location, const std::string& node) const;
std::unordered_map<std::string, std::unordered_map<std::string, NodeType>> m_nodes;
std::set<std::string> m_modules;
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 6431500..bab4715 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -187,13 +187,6 @@
return keys.find(key) != keys.end();
}
-bool YangSchema::nodeExists(const std::string& location, const std::string& node) const
-{
- const auto absPath = location + "/" + node;
- const auto set = m_context->find_path(absPath.c_str());
- return set->number() == 1;
-}
-
libyang::S_Set YangSchema::getNodeSet(const schemaPath_& location, const ModuleNodePair& node) const
{
std::string absPath = location.m_nodes.empty() ? "" : "/";
diff --git a/src/yang_schema.hpp b/src/yang_schema.hpp
index 64e3ac5..baeb466 100644
--- a/src/yang_schema.hpp
+++ b/src/yang_schema.hpp
@@ -37,7 +37,6 @@
bool leafEnumHasValue(const schemaPath_& location, const ModuleNodePair& node, const std::string& value) const override;
bool leafIdentityIsValid(const schemaPath_& location, const ModuleNodePair& node, const ModuleValuePair& value) const override;
bool listHasKey(const schemaPath_& location, const ModuleNodePair& node, const std::string& key) const override;
- bool nodeExists(const std::string& location, const std::string& node) const override;
const std::set<std::string> listKeys(const schemaPath_& location, const ModuleNodePair& node) const override;
yang::LeafDataTypes leafType(const schemaPath_& location, const ModuleNodePair& node) const override;
const std::set<std::string> validIdentities(const schemaPath_& location, const ModuleNodePair& node, const Prefixes prefixes) const override;
@@ -60,7 +59,6 @@
private:
std::set<std::string> modules() const;
- bool nodeExists(const schemaPath_& location, const ModuleNodePair& node) const;
/** @short Returns a set of nodes, that match the location and name criteria. */
std::shared_ptr<libyang::Set> getNodeSet(const schemaPath_& location, const ModuleNodePair& node) const;