12 #include <yaml-cpp/yaml.h> 40 if (node_stack_[depth].isArray())
42 return (getRawNode(depth - 1)[node_stack_[depth].index_]);
46 return (node_stack_[depth].node_);
53 return (getRawNode(node_stack_.size() - 1));
83 return (
impl_->getRawNode().size());
90 YAML::Node child =
impl_->getRawNode()[child_name];
92 if (
false == child.IsDefined() or
true == child.IsNull())
108 impl_->node_stack_.pop_back();
115 YAML::Node selected_node =
impl_->getRawNode();
117 if (
false == selected_node.IsMap())
123 child_names.resize(selected_node.size());
126 for (YAML::const_iterator it = selected_node.begin(); it != selected_node.end(); ++it, ++i)
128 child_names[i] = it->first.as<std::string>();
138 ARILES_ASSERT(
true ==
impl_->getRawNode().IsSequence(),
"Entry is not an array.");
140 std::size_t size =
impl_->getRawNode().size();
150 ARILES_ASSERT(
true ==
impl_->node_stack_.back().isArray(),
"Internal error: expected array.");
152 impl_->node_stack_.back().index_ <
impl_->node_stack_.back().size_,
153 "Internal error: array has more elements than expected.");
154 ++
impl_->node_stack_.back().index_;
161 impl_->node_stack_.pop_back();
165 #define ARILES_BASIC_TYPE(type) \ 166 void Reader::readElement(type &element) \ 168 ARILES_TRACE_FUNCTION; \ 169 element = impl_->getRawNode().as<type>(); \ 174 #undef ARILES_BASIC_TYPE
#define ARILES_TRACE_FUNCTION
const YAML::Node getRawNode(const std::size_t depth)
ARILES_MACRO_SUBSTITUTE(ARILES_BASIC_INTEGER_TYPES_LIST) ARILES_MACRO_SUBSTITUTE(ARILES_BASIC_REAL_TYPES_LIST) void Writer
ariles::Node< YAML::Node > NodeWrapper
std::vector< NodeWrapper > node_stack_
Stack of nodes.
#define ARILES_BASIC_TYPES_LIST
const YAML::Node getRawNode()
Reader(const std::string &file_name)
Constructor.
bool getMapEntryNames(std::vector< std::string > &child_names)
std::size_t getMapSize(const bool)
bool descend(const std::string &child_name)
#define ARILES_VISIBILITY_ATTRIBUTE
ARILES_SHARED_PTR< t_Implementation > ImplPtr