|
Monero
|
Simple DSL AAPI based on. More...
#include <vector>#include <deque>#include <list>#include <set>#include <unordered_set>#include <string>#include <boost/type_traits/is_integral.hpp>#include <boost/type_traits/integral_constant.hpp>#include <boost/mpl/bool.hpp>

Go to the source code of this file.
Classes | |
| struct | is_blob_type< T > |
| a descriptor for dispatching serialize More... | |
Namespaces | |
| namespace | serialization |
| namespace | detail |
| declaration and default definition for the functions used the API | |
| namespace | serialization::detail |
Macros | |
| #define | BLOB_SERIALIZER(T) |
| makes the type have a blob serializer trait defined | |
| #define | VARIANT_TAG(Archive, Type, Tag) |
| Adds the tag \tag to the Archive of Type. | |
| #define | BEGIN_SERIALIZE() |
| Begins the environment of the DSL \detailed for describing how to serialize an of an archive type. | |
| #define | BEGIN_SERIALIZE_OBJECT() |
| begins the environment of the DSL \detailed for described the serialization of an object | |
| #define | PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec) |
| #define | END_SERIALIZE() |
| self-explanatory | |
| #define | FIELD_N(t, f) |
| serializes a field f tagged t | |
| #define | FIELD(f) |
| tags the field with the variable name and then serializes it | |
| #define | FIELDS(f) |
| does not add a tag to the serialized value | |
| #define | VARINT_FIELD(f) |
| tags and serializes the varint f | |
| #define | VARINT_FIELD_N(t, f) |
| tags (as t) and serializes the varint f | |
| #define | MAGIC_FIELD(m) |
| #define | VERSION_FIELD(v) |
Functions | |
| template<class Archive, class T> | |
| std::enable_if_t< is_blob_type< T >::type::value, bool > | do_serialize (Archive &ar, T &v) |
| main function for dispatching serialization for a given pair of archive and value types | |
| template<class Archive, class T> | |
| std::enable_if_t< boost::is_integral< T >::value, bool > | do_serialize (Archive &ar, T &v) |
| template<class Archive, class T> | |
| auto | do_serialize (Archive &ar, T &v) -> decltype(v.member_do_serialize(ar), true) |
| template<class Archive> | |
| bool | do_serialize (Archive &ar, bool &v) |
| template<typename T> | |
| void | serialization::detail::prepare_custom_vector_serialization (size_t size, std::vector< T > &vec, const boost::mpl::bool_< true > &) |
| template<typename T> | |
| void | serialization::detail::prepare_custom_vector_serialization (size_t size, std::vector< T > &vec, const boost::mpl::bool_< false > &) |
| template<class Archive> | |
| bool | serialization::detail::do_check_stream_state (Archive &ar, boost::mpl::bool_< true >, bool noeof) |
| template<class Archive> | |
| bool | serialization::detail::do_check_stream_state (Archive &ar, boost::mpl::bool_< false >, bool noeof) |
| template<class Archive> | |
| bool | serialization::check_stream_state (Archive &ar, bool noeof=false) |
| template<class Archive, class T> | |
| bool | serialization::serialize (Archive &ar, T &v) |
| template<class Archive, class T> | |
| bool | serialization::serialize_noeof (Archive &ar, T &v) |
Simple DSL AAPI based on.
\detailed is_blob_type and has_free_serializer are both descriptors for dispatching on to the serialize function.
The API itself defines a domain specific language via dirty macro hacks. Greenspun's tenth rule is very much in action throughout this entire code base.
| #define BEGIN_SERIALIZE | ( | ) |
| #define BEGIN_SERIALIZE_OBJECT | ( | ) |
begins the environment of the DSL \detailed for described the serialization of an object
\macro BEGIN_SERIALIZE_OBJECT
| #define BLOB_SERIALIZER | ( | T | ) |
makes the type have a blob serializer trait defined
\macro BLOB_SERIALIZER
| #define END_SERIALIZE | ( | ) |
| #define FIELD | ( | f | ) |
| #define FIELD_N | ( | t, | |
| f ) |
| #define FIELDS | ( | f | ) |
does not add a tag to the serialized value
\macro FIELDS(f)
| #define MAGIC_FIELD | ( | m | ) |
\macro MAGIC_FIELD(m)
| #define PREPARE_CUSTOM_VECTOR_SERIALIZATION | ( | size, | |
| vec ) |
\macro PREPARE_CUSTOM_VECTOR_SERIALIZATION
| #define VARIANT_TAG | ( | Archive, | |
| Type, | |||
| Tag ) |
Adds the tag \tag to the Archive of Type.
\macro VARIANT_TAG
| #define VARINT_FIELD | ( | f | ) |
tags and serializes the varint f
\macro VARINT_FIELD(f)
| #define VARINT_FIELD_N | ( | t, | |
| f ) |
tags (as t) and serializes the varint f
\macro VARINT_FIELD_N(t, f)
| #define VERSION_FIELD | ( | v | ) |
|
inline |
|
inline |
|
inline |
main function for dispatching serialization for a given pair of archive and value types
Types marked true with is_blob_type<T> will be serialized as a blob, integral types will be serialized as integers, and types who have a member_do_serialize method will be serialized using that method. Booleans are serialized like blobs.