34 #ifndef _Wolframe_SERLIALIZE_STRUCT_INTRUSIVE_SERIALIZER_HPP_INCLUDED
35 #define _Wolframe_SERLIALIZE_STRUCT_INTRUSIVE_SERIALIZER_HPP_INCLUDED
45 #include <boost/cstdint.hpp>
51 template <
typename TYPE>
89 template <
typename TYPE>
struct Printer {};
91 template <>
struct Printer<boost::int64_t>
93 template <>
struct Printer<boost::uint64_t>
94 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_uint64( (
const boost::uint64_t*)value, element);}};
96 template <>
struct Printer<boost::int32_t>
97 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_int32( (
const boost::int32_t*)value, element);}};
98 template <>
struct Printer<boost::uint32_t>
99 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_uint32( (
const boost::uint32_t*)value, element);}};
101 template <>
struct Printer<boost::int16_t>
102 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_short( (
const boost::int16_t*)value, element);}};
103 template <>
struct Printer<boost::uint16_t>
104 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_ushort( (
const boost::uint16_t*)value, element);}};
106 template <>
struct Printer<signed char>
107 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_char( (
const signed char*)value, element);}};
108 template <>
struct Printer<unsigned char>
109 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_uchar( (
const unsigned char*)value, element);}};
111 template <>
struct Printer<bool>
112 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_bool( (
const bool*)value, element);}};
114 template <>
struct Printer<float>
115 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_float( (
const float*)value, element);}};
117 template <>
struct Printer<double>
118 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_double( (
const double*)value, element);}};
120 template <>
struct Printer<std::string>
121 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_string( (
const std::string*)value, element);}};
123 template <>
struct Printer<types::DateTime>
124 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_datetime( (
const types::DateTime*)value, element);}};
126 template <>
struct Printer<types::BigNumber>
127 {
static bool printValue(
const void* value, types::VariantConst& element) {
return printValue_bignumber( (
const types::BigNumber*)value, element);}};
130 template <
typename TYPE>
133 static const StructDescriptionBase* descr = TYPE::getStructDescription();
137 template <
typename TYPE>
143 template <
typename TYPE>
146 const std::vector<typename TYPE::value_type>* obj = (
const TYPE*)stk.back().value();
147 std::size_t idx = stk.back().state();
148 if (idx >= obj->size())
153 const void* ve = &(*obj)[ idx];
158 template <
typename TYPE>
bool fetchObjectStruct(const StructDescriptionBase *descr, Context &ctx, SerializeStateStack &stk)
bool fetchOpenTag(Context &ctx, SerializeStateStack &stk)
Type for representing arbitrary precision fixed point numbers and big integers as binary coded decima...
static bool fetch(Context &ctx, SerializeStateStack &stk)
Definition: intrusiveSerializer.hpp:159
bool printValue_double(const double *, types::VariantConst &element)
bool printValue_bool(const bool *, types::VariantConst &element)
defines the type traits for the intrusive part of serialization/deserialization
Base class for structure description used for introspection in serialization/deserialization.
Definition: structDescriptionBase.hpp:51
bool printValue_short(const signed short *, types::VariantConst &element)
Type for representing big numbers as binary coded decimal (BCD) numbers.
Definition: bignumber.hpp:49
bool printValue_int32(const boost::int32_t *, types::VariantConst &element)
bool fetchObjectAtomic(PrintValue prnt, Context &ctx, SerializeStateStack &stk)
Data type for normalized date time (absolute time without time zone info)
Definition: datetime.hpp:55
bool printValue_string(const std::string *, types::VariantConst &element)
bool printValue_uint64(const boost::uint64_t *, types::VariantConst &element)
forward declaration
Definition: intrusiveSerializer.hpp:52
bool printValue(const ValueType &val, types::VariantConst &element)
Definition: printValue.hpp:178
bool fetchObjectVectorElement(FetchElement fetchElement, const void *ve, Context &ctx, SerializeStateStack &stk)
Defines the parsing stack for serialization of objects.
Variant value type that represents a variant copy without content ownership.
Definition: variant.hpp:286
bool printValue_int64(const boost::int64_t *, types::VariantConst &element)
bool printValue_bignumber(const types::BigNumber *, types::VariantConst &element)
bool(* PrintValue)(const void *ptr, types::VariantConst &value)
Definition: intrusiveSerializer.hpp:63
bool printValue_datetime(const types::DateTime *, types::VariantConst &element)
bool printValue_char(const signed char *, types::VariantConst &element)
Date and datetime value type.
bool(* FetchElement)(Context &ctx, SerializeStateStack &stk)
Definition: intrusiveSerializer.hpp:84
std::vector< SerializeState > SerializeStateStack
State stack for an iterator on a structure (serializer)
Definition: serializeStack.hpp:79
bool printValue_uchar(const unsigned char *, types::VariantConst &element)
bool fetchCloseTag(Context &ctx, SerializeStateStack &stk)
bool printValue_float(const float *, types::VariantConst &element)
Defines the non intrusive base class of serialization/deserialization of objects interfaced as TypedI...
Typed interface for input/output filter.
Global state variables of a running serialization/deserialization procedure (without the stack) ...
Definition: mapContext.hpp:46
bool printValue_uint32(const boost::uint32_t *, types::VariantConst &element)
boost::enable_if_c< boost::is_same< std::vector< typename T::value_type >,T >::value &&!boost::is_same< std::string, T >::value,const vector_ & >::type getCategory(const T &)
get category vector_ for a type
Definition: traits_getCategory.hpp:90
bool printValue_ushort(const unsigned short *, types::VariantConst &element)