Add modules
Change-Id: Idafb0f57dd032d4f88658de15d293bdefac0567f
diff --git a/src/schema.hpp b/src/schema.hpp
index 7c05d17..2059e1b 100644
--- a/src/schema.hpp
+++ b/src/schema.hpp
@@ -40,10 +40,13 @@
yang::LeafDataTypes m_type;
std::set<std::string> m_enumValues;
};
+
+struct module {
+};
}
-using NodeType = boost::variant<yang::container, yang::list, yang::leaf>;
+using NodeType = boost::variant<yang::container, yang::list, yang::leaf, yang::module>;
class InvalidNodeException : public std::invalid_argument {
@@ -55,19 +58,24 @@
/*! \class Schema
* \brief A base schema class for schemas
* */
+
+using ModuleNodePair = std::pair<boost::optional<std::string>, std::string>;
+
class Schema {
public:
virtual ~Schema();
- virtual bool isContainer(const path_& location, const std::string& name) const = 0;
- virtual bool isLeaf(const path_& location, const std::string& name) const = 0;
- virtual bool isList(const path_& location, const std::string& name) const = 0;
- virtual bool isPresenceContainer(const path_& location, const std::string& name) const = 0;
- virtual bool leafEnumHasValue(const path_& location, const std::string& name, const std::string& value) const = 0;
- virtual bool listHasKey(const path_& location, const std::string& name, const std::string& key) const = 0;
- virtual bool nodeExists(const std::string& location, const std::string& name) const = 0;
- virtual const std::set<std::string>& listKeys(const path_& location, const std::string& name) const = 0;
- virtual yang::LeafDataTypes leafType(const path_& location, const std::string& name) const = 0;
+ virtual bool isContainer(const path_& location, const ModuleNodePair& node) const = 0;
+ virtual bool isLeaf(const path_& location, const ModuleNodePair& node) const = 0;
+ virtual bool isModule(const path_& location, const std::string& name) const = 0;
+ virtual bool isList(const path_& location, const ModuleNodePair& node) const = 0;
+ virtual bool isPresenceContainer(const path_& location, const ModuleNodePair& node) const = 0;
+ virtual bool leafEnumHasValue(const path_& location, const ModuleNodePair& node, const std::string& value) const = 0;
+ virtual bool listHasKey(const path_& 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 path_& location, const ModuleNodePair& node) const = 0;
+ virtual yang::LeafDataTypes leafType(const path_& location, const ModuleNodePair& node) const = 0;
+ virtual std::set<std::string> childNodes(const path_& path) const = 0;
private:
const std::unordered_map<std::string, NodeType>& children(const std::string& name) const;