47#include <unordered_set>
49#include <boost/type_traits/is_integral.hpp>
50#include <boost/type_traits/integral_constant.hpp>
73template<
typename F,
typename S>
91template <
class Archive,
class T>
97 static bool serialize(Archive &ar,
T &v, boost::false_type, boost::true_type,
A a) {
98 ar.serialize_blob(&v,
sizeof(v));
102 static bool serialize(Archive &ar,
T &v, boost::true_type, boost::false_type,
A a) {
106 static bool serialize(Archive &ar,
T &v, boost::false_type, boost::false_type, boost::false_type) {
108 return v.do_serialize(ar);
110 static bool serialize(Archive &ar,
T &v, boost::false_type, boost::false_type, boost::true_type) {
122template <
class Archive,
class T>
125 return ::serializer<Archive, T>::serialize(ar, v);
127template <
class Archive>
130 ar.serialize_blob(&v,
sizeof(v));
147#define BLOB_SERIALIZER(T) \
149 struct is_blob_type<T> { \
150 typedef boost::true_type type; \
157#define FREE_SERIALIZER(T) \
159 struct has_free_serializer<T> { \
160 typedef boost::true_type type; \
167#define VARIANT_TAG(Archive, Type, Tag) \
169 struct variant_serialization_traits<Archive<W>, Type> { \
170 static inline typename Archive<W>::variant_tag_type get_tag() { \
181#define BEGIN_SERIALIZE() \
182 template <bool W, template <bool> class Archive> \
183 bool do_serialize(Archive<W> &ar) {
190#define BEGIN_SERIALIZE_OBJECT() \
191 template <bool W, template <bool> class Archive> \
192 bool do_serialize(Archive<W> &ar) { \
194 bool r = do_serialize_object(ar); \
198 template <bool W, template <bool> class Archive> \
199 bool do_serialize_object(Archive<W> &ar){
203#define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec) \
204 ::serialization::detail::prepare_custom_vector_serialization(size, vec, typename Archive<W>::is_saving())
208#define PREPARE_CUSTOM_DEQUE_SERIALIZATION(size, vec) \
209 ::serialization::detail::prepare_custom_deque_serialization(size, vec, typename Archive<W>::is_saving())
214#define END_SERIALIZE() \
215 return ar.stream().good(); \
224 bool r = ::do_serialize(ar, f); \
225 if (!r || !ar.stream().good()) return false; \
232#define FIELD_N(t, f) \
235 bool r = ::do_serialize(ar, f); \
236 if (!r || !ar.stream().good()) return false; \
246 bool r = ::do_serialize(ar, f); \
247 if (!r || !ar.stream().good()) return false; \
256 bool r = ::do_serialize(ar, f); \
257 if (!r || !ar.stream().good()) return false; \
263#define VARINT_FIELD(f) \
266 ar.serialize_varint(f); \
267 if (!ar.stream().good()) return false; \
274#define VARINT_FIELD_N(t, f) \
277 ar.serialize_varint(f); \
278 if (!ar.stream().good()) return false; \
294 template <
typename T>
299 template <
typename T>
305 template <
typename T>
310 template <
typename T>
320 template<
class Stream>
331 template<
class Stream>
337 std::ios_base::iostate
state = s.rdstate();
338 result = noeof || EOF == s.peek();
349 template<
class Archive>
359 template <
class Archive,
class T>
370 template <
class Archive,
class T>
Concept for reading and writing characters.
void prepare_custom_deque_serialization(size_t size, std::deque< T > &vec, const boost::mpl::bool_< true > &)
void prepare_custom_vector_serialization(size_t size, std::vector< T > &vec, const boost::mpl::bool_< true > &)
bool do_check_stream_state(Stream &s, boost::mpl::bool_< true >, bool noeof)
bool serialize_noeof(Archive &ar, T &v)
bool check_stream_state(Archive &ar, bool noeof=false)
bool serialize(Archive &ar, T &v)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
bool do_serialize(Archive< false > &ar, std::vector< crypto::signature > &v)
bool do_serialize(Archive &ar, T &v)
just calls the serialize function defined for ar and v...
a descriptor for dispatching serialize
a descriptor for dispatching serialize
a descriptor for dispatching serialize
... wouldn't a class be better?
static bool serialize(Archive &ar, T &v, boost::false_type, boost::false_type, boost::false_type)
static void serialize_custom(Archive &ar, T &v, boost::true_type)
static bool serialize(Archive &ar, T &v, boost::false_type, boost::true_type, A a)
static bool serialize(Archive &ar, T &v, boost::false_type, boost::false_type, boost::true_type)
static bool serialize(Archive &ar, T &v)
static bool serialize(Archive &ar, T &v, boost::true_type, boost::false_type, A a)