8 #ifndef SCARAB_PARAM_MSGPACK_HH_ 9 #define SCARAB_PARAM_MSGPACK_HH_ 11 #include "msgpack_fwd.hpp" 24 LOGGER(dlog_param_msgpack,
"param_msgpack");
36 static param* read_file(
const std::string& a_filename );
37 static param* read_string(
const std::string& a_msgpack_str );
38 static param* read_msgpack_element(
const msgpack::object& a_msgpack_array );
67 template<
class XWriter >
68 static bool write_param(
const param& a_to_write, XWriter* a_writer );
69 template<
class XWriter >
70 static bool write_param_null(
const param& a_to_write, XWriter* a_writer );
71 template<
class XWriter >
72 static bool write_param_value(
const param_value& a_to_write, XWriter* a_writer );
73 template<
class XWriter >
74 static bool write_param_array(
const param_array& a_to_write, XWriter* a_writer );
75 template<
class XWriter >
76 static bool write_param_node(
const param_node& a_to_write, XWriter* a_writer );
80 template<
class XWriter >
99 LWARN( dlog_param_msgpack,
"parameter not written: <" << a_to_write <<
">" );
102 template<
class XWriter >
109 template<
class XWriter >
115 a_writer->String( a_to_write.
as_string().c_str() );
118 else if( a_to_write.
is_bool() )
120 a_writer->Bool( a_to_write.
as_bool() );
123 else if( a_to_write.
is_int() )
125 a_writer->Int64( a_to_write.
as_int() );
128 else if( a_to_write.
is_uint() )
130 a_writer->Uint64( a_to_write.
as_uint() );
135 a_writer->Double( a_to_write.
as_double() );
140 template<
class XWriter >
144 a_writer->StartArray();
149 LERROR( dlog_param_msgpack,
"Error while writing parameter array" );
153 a_writer->EndArray();
156 template<
class XWriter >
160 a_writer->StartObject();
163 a_writer->String( it->first.c_str() );
166 LERROR( dlog_param_msgpack,
"Error while writing parameter node" );
170 a_writer->EndObject();
virtual bool is_node() const
static bool write_param_node(const param_node &a_to_write, XWriter *a_writer)
static bool write_param_value(const param_value &a_to_write, XWriter *a_writer)
static bool write_param_null(const param &a_to_write, XWriter *a_writer)
virtual bool is_value() const
static bool write_param(const param &a_to_write, XWriter *a_writer)
static bool write_param_array(const param_array &a_to_write, XWriter *a_writer)
Contains the logger class and macros, based on Kasper's KLogger class.
contents::const_iterator const_iterator
virtual bool is_null() const
const std::string & as_string() const
contents::const_iterator const_iterator
virtual bool is_array() const
LOGGER(mtlog,"authentication")