16 #include <msgpack.hpp>    23     namespace ns_msgpack_compact
    32     namespace ns_msgpack_compact
    55                     std::stringstream str_stream;
    56                     str_stream << input_stream.rdbuf();
    57                     buffer_ = str_stream.str();
    61                         unpack(handle_, buffer_.data(), buffer_.size(), 0);
    64                     catch (
const std::exception &e)
    66                         ARILES_THROW(std::string(
"Failed to parse the configuration file: ") + e.what());
    76                 const ::msgpack::object &
getRawNode(
const std::size_t depth)
    78                     if (node_stack_[depth].isArray())
    80                         return (getRawNode(depth - 1).via.array.ptr[node_stack_[depth].index_]);
    84                         return (*node_stack_[depth].node_);
    91                     return (getRawNode(node_stack_.size() - 1));
   102     namespace ns_msgpack_compact
   106             std::ifstream config_ifs;
   109             impl_->initialize(config_ifs);
   116             impl_->initialize(input_stream);
   122             return (
impl_->getRawNode().via.array.size);
   135                     true == 
impl_->node_stack_.back().isAllParsed(),
   136                     "Some entries were not parsed, which is not allowed by this visitor.");
   137             impl_->node_stack_.pop_back();
   143             if (
true == 
impl_->node_stack_.back().isArray())
   152             std::size_t size = 
impl_->getRawNode().via.array.size;
   161             impl_->node_stack_.pop_back();
   167             ARILES_ASSERT(
true == 
impl_->node_stack_.back().isArray(), 
"Internal error: expected array.");
   169                     impl_->node_stack_.back().index_ < 
impl_->node_stack_.back().size_,
   170                     "Internal error: array has more elements than expected.");
   171             ++
impl_->node_stack_.back().index_;
   175 #define ARILES_BASIC_TYPE(type)                                                                                        \   176     void Reader::readElement(type &element)                                                                            \   178         impl_->getRawNode() >> element;                                                                                \   183 #undef ARILES_BASIC_TYPE 
std::size_t startMapImpl(const std::size_t size)
std::vector< NodeWrapper > node_stack_
Stack of nodes.
Reader(const std::string &file_name)
Constructor.
void initialize(std::istream &input_stream)
open configuration file
const ::msgpack::object & getRawNode()
static void openFile(std::ifstream &config_ifs, const std::string &file_name)
open configuration file
const ::msgpack::object & getRawNode(const std::size_t depth)
Get current node.
#define ARILES_BASIC_TYPES_LIST
void ascend()
Ascend from the current entry to its parent.
::msgpack::object_handle handle_
std::size_t getMapSize(const bool)
ariles::Node< const ::msgpack::object * > NodeWrapper
ARILES_MACRO_SUBSTITUTE(ARILES_BASIC_NUMERIC_TYPES_LIST) void Writer
#define ARILES_VISIBILITY_ATTRIBUTE
ARILES_SHARED_PTR< impl::Reader > ImplPtr