23 #include "yaml-cpp/yaml.h" 33 nodes_.push_back( YAML::Load( in ) );
53 ASSERT(
head().IsSequence()).error(
"Head node must be of type Array.");
55 if ( index >=
head().size() )
return false;
56 path_.push_back( make_pair( index,
string(
"") ) );
64 ASSERT(
head().IsMap()).error(
"Head node must be of type Record.");
67 path_.push_back( make_pair( index, key) );
77 if (
path_.size() > 1) {
85 return head().IsNull();
90 if (
head().IsScalar()) {
92 return head().as<
bool>();
93 }
catch (YAML::Exception) {
94 THROW( ReaderInternalBase::ExcInputError() );
97 THROW( ReaderInternalBase::ExcInputError() );
104 if (
head().IsScalar()) {
106 return head().as<std::int64_t>();
107 }
catch (YAML::Exception) {
108 THROW( ReaderInternalBase::ExcInputError() );
111 THROW( ReaderInternalBase::ExcInputError() );
118 if (
head().IsScalar()) {
120 return head().as<
double>();
121 }
catch (YAML::Exception) {
122 THROW( ReaderInternalBase::ExcInputError() );
125 THROW( ReaderInternalBase::ExcInputError() );
132 if (
head().IsScalar()) {
134 return head().as<std::string>();
135 }
catch (YAML::Exception) {
136 THROW( ReaderInternalBase::ExcInputError() );
139 THROW( ReaderInternalBase::ExcInputError() );
146 switch (
head().Type()) {
157 if (
head().IsMap() ) {
158 for (YAML::const_iterator
it=
head().begin();
it!=
head().end(); ++
it) {
159 keys_list.insert(
it->first.as<std::string>() );
169 if (
head().IsSequence()) {
170 return head().size();
177 return head().IsMap();
182 return head().IsSequence();
199 std::string tag =
head().Tag();
200 if ( (tag ==
"?") || (tag.size() == 0) ) {
203 return tag.erase(0, 1);
210 if (
head().IsNull() ) {
213 }
else if (
head().IsScalar() ) {
216 return (
head().as<std::string>() ==
"");
217 }
catch (YAML::Exception) {
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Global macros to enhance readability and debugging, general constants.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.