47 #include <unordered_set> 49 #include <boost/type_traits/is_integral.hpp> 50 #include <boost/type_traits/integral_constant.hpp> 51 #include <boost/mpl/bool.hpp> 74 template<
typename F,
typename S>
92 template <
class Archive,
class T>
99 ar.serialize_blob(&v,
sizeof(v));
107 static bool serialize(Archive &ar,
T &v, boost::false_type, boost::false_type, boost::false_type) {
109 return v.do_serialize(ar);
123 template <
class Archive,
class T>
128 template <
class Archive>
131 ar.serialize_blob(&v,
sizeof(v));
148 #define BLOB_SERIALIZER(T) \ 150 struct is_blob_type<T> { \ 151 typedef boost::true_type type; \ 158 #define FREE_SERIALIZER(T) \ 160 struct has_free_serializer<T> { \ 161 typedef boost::true_type type; \ 168 #define VARIANT_TAG(Archive, Type, Tag) \ 170 struct variant_serialization_traits<Archive<W>, Type> { \ 171 static inline typename Archive<W>::variant_tag_type get_tag() { \ 182 #define BEGIN_SERIALIZE() \ 183 template <bool W, template <bool> class Archive> \ 184 bool do_serialize(Archive<W> &ar) { 191 #define BEGIN_SERIALIZE_OBJECT() \ 192 template <bool W, template <bool> class Archive> \ 193 bool do_serialize(Archive<W> &ar) { \ 195 bool r = do_serialize_object(ar); \ 199 template <bool W, template <bool> class Archive> \ 200 bool do_serialize_object(Archive<W> &ar){ 204 #define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec) \ 205 ::serialization::detail::prepare_custom_vector_serialization(size, vec, typename Archive<W>::is_saving()) 209 #define PREPARE_CUSTOM_DEQUE_SERIALIZATION(size, vec) \ 210 ::serialization::detail::prepare_custom_deque_serialization(size, vec, typename Archive<W>::is_saving()) 215 #define END_SERIALIZE() \ 216 return ar.stream().good(); \ 225 bool r = ::do_serialize(ar, f); \ 226 if (!r || !ar.stream().good()) return false; \ 233 #define FIELD_N(t, f) \ 236 bool r = ::do_serialize(ar, f); \ 237 if (!r || !ar.stream().good()) return false; \ 247 bool r = ::do_serialize(ar, f); \ 248 if (!r || !ar.stream().good()) return false; \ 257 bool r = ::do_serialize(ar, f); \ 258 if (!r || !ar.stream().good()) return false; \ 264 #define VARINT_FIELD(f) \ 267 ar.serialize_varint(f); \ 268 if (!ar.stream().good()) return false; \ 275 #define VARINT_FIELD_N(t, f) \ 278 ar.serialize_varint(f); \ 279 if (!ar.stream().good()) return false; \ 284 #define MAGIC_FIELD(m) \ 285 std::string magic = m; \ 288 ar.serialize_blob((void*)magic.data(), magic.size()); \ 289 if (!ar.stream().good()) return false; \ 290 if (magic != m) return false; \ 295 #define VERSION_FIELD(v) \ 296 uint32_t version = v; \ 299 ar.serialize_varint(version); \ 300 if (!ar.stream().good()) return false; \ 316 template <
typename T>
321 template <
typename T>
327 template <
typename T>
332 template <
typename T>
342 template<
class Stream>
353 template<
class Stream>
359 std::ios_base::iostate
state =
s.rdstate();
360 result = noeof || EOF ==
s.peek();
371 template<
class Archive>
381 template <
class Archive,
class T>
392 template <
class Archive,
class T>
Definition: binary_utils.h:36
const uint32_t T[512]
Definition: groestl_tables.h:36
static void serialize_custom(Archive &ar, T &v, boost::true_type)
Definition: serialization.h:115
static bool serialize(Archive &ar, T &v, boost::false_type, boost::false_type, boost::false_type)
Definition: serialization.h:107
bool check_stream_state(Archive &ar, bool noeof=false)
Definition: serialization.h:372
boost::true_type type
Definition: serialization.h:77
static bool serialize(Archive &ar, T &v)
Definition: serialization.h:94
Definition: blockchain_ancestry.cpp:71
boost::false_type type
Definition: serialization.h:72
void prepare_custom_vector_serialization(size_t size, std::vector< T > &vec, const boost::mpl::bool_< true > &)
Definition: serialization.h:317
a descriptor for dispatching serialize
Definition: serialization.h:58
a descriptor for dispatching serialize
Definition: serialization.h:72
bool serialize(Archive &ar, T &v)
Definition: serialization.h:382
declaration and default definition for the functions used the API
Definition: expect.cpp:33
a descriptor for dispatching serialize
Definition: serialization.h:65
boost::true_type type
Definition: serialization.h:65
boost::false_type type
Definition: serialization.h:58
... wouldn't a class be better?
Definition: serialization.h:93
boost::true_type type
Definition: serialization.h:75
static bool serialize(Archive &ar, T &v, boost::true_type, boost::false_type, A a)
Definition: serialization.h:103
Definition: blake256.h:36
static bool serialize(Archive &ar, T &v, boost::false_type, boost::true_type, A a)
Definition: serialization.h:98
string a
Definition: MakeCryptoOps.py:15
char true_type
Definition: sfinae_helpers.h:39
void prepare_custom_deque_serialization(size_t size, std::deque< T > &vec, const boost::mpl::bool_< true > &)
Definition: serialization.h:328
bool do_serialize(Archive &ar, T &v)
just calls the serialize function defined for ar and v...
Definition: serialization.h:124
bool serialize_noeof(Archive &ar, T &v)
Definition: serialization.h:393
#define s(x, c)
Definition: aesb.c:47
static bool serialize(Archive &ar, T &v, boost::false_type, boost::false_type, boost::true_type)
Definition: serialization.h:111
bool do_check_stream_state(Stream &s, boost::mpl::bool_< true >, bool noeof)
Definition: serialization.h:343