32 nodes_.push_back( YAML::Load( in ) );
52 ASSERT(
head().IsSequence()).error(
"Head node must be of type Array.");
54 if ( index >=
head().size() )
return false;
55 path_.push_back( make_pair( index,
string(
"") ) );
63 ASSERT(
head().IsMap()).error(
"Head node must be of type Record.");
66 path_.push_back( make_pair( (
int)(-1), key) );
76 if (
path_.size() > 1) {
84 return head().IsNull();
89 if (
head().IsScalar()) {
91 return head().as<
bool>();
92 }
catch (YAML::Exception) {
93 THROW( ReaderToStorage::ExcInputError() );
96 THROW( ReaderToStorage::ExcInputError() );
103 if (
head().IsScalar()) {
105 return head().as<std::int64_t>();
106 }
catch (YAML::Exception) {
107 THROW( ReaderToStorage::ExcInputError() );
110 THROW( ReaderToStorage::ExcInputError() );
117 if (
head().IsScalar()) {
119 return head().as<
double>();
120 }
catch (YAML::Exception) {
121 THROW( ReaderToStorage::ExcInputError() );
124 THROW( ReaderToStorage::ExcInputError() );
131 if (
head().IsScalar()) {
133 return head().as<std::string>();
134 }
catch (YAML::Exception) {
135 THROW( ReaderToStorage::ExcInputError() );
138 THROW( ReaderToStorage::ExcInputError() );
145 switch (
head().Type()) {
156 if (
head().IsMap() ) {
157 for (YAML::const_iterator
it=
head().begin();
it!=
head().end(); ++
it) {
158 keys_list.insert(
it->first.as<std::string>() );
168 if (
head().IsSequence()) {
169 return head().size();
176 return head().IsMap();
181 return head().IsSequence();
198 std::string tag =
head().Tag();
202 return tag.erase(0, 1);
209 if (
head().IsNull() ) {
212 }
else if (
head().IsScalar() ) {
215 return (
head().as<std::string>() ==
"");
216 }
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.