47 #include <unordered_set>
49 #include <boost/type_traits/is_integral.hpp>
50 #include <boost/type_traits/integral_constant.hpp>
73 template<
typename F,
typename S>
91 template <
class Archive,
class T>
98 ar.serialize_blob(&v,
sizeof(v));
106 static bool serialize(Archive &ar,
T &v, boost::false_type, boost::false_type, boost::false_type) {
108 return v.do_serialize(ar);
122 template <
class Archive,
class T>
127 template <
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>
#define s(x, c)
Definition: aesb.c:47
const uint32_t T[512]
Definition: groestl_tables.h:37
string a
Definition: MakeCryptoOps.py:15
declaration and default definition for the functions used the API
Definition: expect.cpp:34
void prepare_custom_deque_serialization(size_t size, std::deque< T > &vec, const boost::mpl::bool_< true > &)
Definition: serialization.h:306
void prepare_custom_vector_serialization(size_t size, std::vector< T > &vec, const boost::mpl::bool_< true > &)
Definition: serialization.h:295
bool do_check_stream_state(Stream &s, boost::mpl::bool_< true >, bool noeof)
Definition: serialization.h:321
Definition: binary_utils.h:37
bool serialize_noeof(Archive &ar, T &v)
Definition: serialization.h:371
bool check_stream_state(Archive &ar, bool noeof=false)
Definition: serialization.h:350
bool serialize(Archive &ar, T &v)
Definition: serialization.h:360
char true_type
Definition: sfinae_helpers.h:39
Definition: blockchain_ancestry.cpp:73
bool do_serialize(Archive &ar, T &v)
just calls the serialize function defined for ar and v...
Definition: serialization.h:123
a descriptor for dispatching serialize
Definition: serialization.h:64
boost::true_type type
Definition: serialization.h:64
boost::true_type type
Definition: serialization.h:74
boost::true_type type
Definition: serialization.h:76
a descriptor for dispatching serialize
Definition: serialization.h:71
boost::false_type type
Definition: serialization.h:71
a descriptor for dispatching serialize
Definition: serialization.h:57
boost::false_type type
Definition: serialization.h:57
... wouldn't a class be better?
Definition: serialization.h:92
static bool serialize(Archive &ar, T &v, boost::false_type, boost::false_type, boost::false_type)
Definition: serialization.h:106
static void serialize_custom(Archive &ar, T &v, boost::true_type)
Definition: serialization.h:114
static bool serialize(Archive &ar, T &v, boost::false_type, boost::true_type, A a)
Definition: serialization.h:97
static bool serialize(Archive &ar, T &v, boost::false_type, boost::false_type, boost::true_type)
Definition: serialization.h:110
static bool serialize(Archive &ar, T &v)
Definition: serialization.h:93
static bool serialize(Archive &ar, T &v, boost::true_type, boost::false_type, A a)
Definition: serialization.h:102
Definition: blake256.h:37