14 #include <msgpack.hpp> 19 namespace ns_msgpack_compact
27 void operator=(
const Writer &);
40 explicit Writer(
const std::string &file_name)
43 output_stream_ = &config_ofs_;
44 packer_ = new ::msgpack::packer<std::ostream>(*output_stream_);
48 explicit Writer(std::ostream &output_stream)
50 output_stream_ = &output_stream;
51 packer_ = new ::msgpack::packer<std::ostream>(*output_stream_);
67 namespace ns_msgpack_compact
83 impl_->packer_->pack_array(num_entries);
89 impl_->output_stream_->flush();
95 ARILES_ASSERT(size <= std::numeric_limits<uint32_t>::max(),
"Vector is too long.");
96 impl_->packer_->pack_array(size);
100 #define ARILES_BASIC_TYPE(type) \ 101 void Writer::writeElement(const type &element) \ 103 impl_->packer_->pack(element); \ 108 #undef ARILES_BASIC_TYPE Writer(std::ostream &output_stream)
Writer(const std::string &file_name)
Constructor.
::msgpack::packer< std::ostream > * packer_
void startMap(const std::size_t num_entries)
Starts a nested map in the configuration file.
class ARILES_VISIBILITY_ATTRIBUTE Writer
Writer(const std::string &file_name)
#define ARILES_BASIC_TYPES_LIST
void flush()
Flush the configuration to the output.
static void openFile(std::ofstream &config_ofs, const std::string &file_name)
open configuration file
void startArray(const std::size_t size, const bool=false)
std::ostream * output_stream_
output stream
ARILES_MACRO_SUBSTITUTE(ARILES_BASIC_NUMERIC_TYPES_LIST) void Writer
std::ofstream config_ofs_
output file stream
#define ARILES_VISIBILITY_ATTRIBUTE
ARILES_SHARED_PTR< impl::Writer > ImplPtr