18 #ifndef LUNCHBOX_ANYSERIALIZATION_H 19 #define LUNCHBOX_ANYSERIALIZATION_H 21 #include <lunchbox/any.h> 23 #include <servus/uint128_t.h> 25 #include <boost/mpl/for_each.hpp> 26 #include <boost/mpl/list.hpp> 28 #include <boost/serialization/export.hpp> 29 #include <boost/serialization/extended_type_info.hpp> 36 #define SERIALIZABLEANY(CLASS) BOOST_CLASS_EXPORT(lunchbox::Any::holder<CLASS>) 41 typedef boost::mpl::list<int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
42 int64_t, uint64_t, float, double, bool, std::string,
51 template <
class Archive>
52 struct registerWrapper
54 explicit registerWrapper(Archive& ar)
63 ar_.template register_type<Any::holder<T> >();
72 template <
class TypeList,
class Archive>
75 boost::mpl::for_each<TypeList>(registerWrapper<Archive>(ar));
82 template <
class Archive,
class Object,
class Stream>
86 registerTypelist<podTypes>(ar);
94 template <
class Archive,
class Object,
class Stream>
95 void saveAny(Object&
object, Stream& stream)
98 registerTypelist<podTypes>(ar);
106 template <
class Archive,
class Object,
class Stream>
110 registerTypelist<podTypes>(ar);
void registerTypelist(Archive &ar)
Registers the types from the given type list for serializing it inside a lunchbox::Any through the gi...
Basic type definitions not provided by the operating system.
boost::mpl::list< int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float, double, bool, std::string, servus::uint128_t > podTypes
List of supported POD types for lunchbox::Any serialization.
void serializeAny(Object &object, Stream &stream)
Serializes the given object which can be a lunchbox::Any through the given archive type to/from the g...
Abstraction layer and common utilities for multi-threaded programming.
void saveAny(Object &object, Stream &stream)
Saves the given object which can be a lunchbox::Any through the given archive type to/from the given ...
void loadAny(Object &object, Stream &stream)
Loads the given object which can be a lunchbox::Any through the given archive type to/from the given ...