add presence containers
Change-Id: Ic8e33d68e496deae9dfe4c3e5ebcecbd45ee31b2
diff --git a/src/schema.cpp b/src/schema.cpp
index 1760b5d..fa72f81 100644
--- a/src/schema.cpp
+++ b/src/schema.cpp
@@ -6,7 +6,6 @@
*
*/
-#include <iostream>
#include "schema.hpp"
#include "utils.hpp"
@@ -60,9 +59,9 @@
return children(locationString).at(name).type() == typeid(yang::container);
}
-void Schema::addContainer(const std::string& location, const std::string& name)
+void Schema::addContainer(const std::string& location, const std::string& name, yang::ContainerTraits isPresence)
{
- m_nodes.at(location).emplace(name, yang::container{});
+ m_nodes.at(location).emplace(name, yang::container{isPresence});
//create a new set of children for the new node
std::string key = joinPaths(location, name);
@@ -108,3 +107,11 @@
m_nodes.emplace(name, std::unordered_map<std::string, NodeType>());
}
+
+bool Schema::isPresenceContainer(const path_& location, const std::string& name) const
+{
+ if (!isContainer(location, name))
+ return false;
+ std::string locationString = pathToString(location);
+ return boost::get<yang::container>(children(locationString).at(name)).m_presence == yang::ContainerTraits::Presence;
+}