30#ifndef CEREAL_DETAILS_HELPERS_HPP_ 
   31#define CEREAL_DETAILS_HELPERS_HPP_ 
   37#include <unordered_map> 
   50    explicit Exception( 
const std::string & what_ ) : std::runtime_error(what_) {}
 
   51    explicit Exception( 
const char * what_ ) : std::runtime_error(what_) {}
 
  144      using Type = 
typename std::conditional<std::is_array<typename std::remove_reference<T>::type>::value,
 
  145                                             typename std::remove_cv<T>::type,
 
  146                                             typename std::conditional<std::is_lvalue_reference<T>::value,
 
  148                                                                       typename std::decay<T>::type>::type>::type;
 
  151      static_assert( !std::is_base_of<detail::NameValuePairCore, T>::value,
 
  152                     "Cannot pair a name to a NameValuePair" );
 
  165      NameValuePair( 
char const * n, T && v ) : name(n), value(std::forward<T>(v)) {}
 
  174  template<
class Archive, 
class T> 
inline 
  176  std::enable_if<std::is_same<Archive, ::cereal::BinaryInputArchive>::value ||
 
  177                 std::is_same<Archive, ::cereal::BinaryOutputArchive>::value,
 
  181    return std::forward<T>(value);
 
  187  template<
class Archive, 
class T> 
inline 
  189  std::enable_if<!std::is_same<Archive, ::cereal::BinaryInputArchive>::value &&
 
  190                 !std::is_same<Archive, ::cereal::BinaryOutputArchive>::value,
 
  194    return {name, std::forward<T>(value)};
 
  201  #define CEREAL_NVP_(name, value) ::cereal::make_nvp<Archive>(name, value) 
  215    using PT = 
typename std::conditional<std::is_const<typename std::remove_pointer<typename std::remove_reference<T>::type>::type>::value,
 
  237      using Type = 
typename std::conditional<std::is_array<typename std::remove_reference<T>::type>::value,
 
  238                                             typename std::remove_cv<T>::type,
 
  239                                             typename std::conditional<std::is_lvalue_reference<T>::value,
 
  241                                                                       typename std::decay<T>::type>::type>::type;
 
  244      static_assert( !std::is_base_of<detail::DeferredDataCore, T>::value,
 
  245                     "Cannot defer DeferredData" );
 
  278        virtual void rtti() {}
 
  290        virtual void rtti() {}
 
  298    static const uint32_t msb_32bit  = 0x80000000;
 
  299    static const int32_t msb2_32bit = 0x40000000;
 
  317      using Type = 
typename std::conditional<std::is_lvalue_reference<T>::value,
 
  319                                             typename std::decay<T>::type>::type;
 
  324      SizeTag( T && sz ) : size(std::forward<T>(sz)) {}
 
  350  template <
class Key, 
class Value>
 
  353    using KeyType = 
typename std::conditional<
 
  354      std::is_lvalue_reference<Key>::value,
 
  356      typename std::decay<Key>::type>::type;
 
  358    using ValueType = 
typename std::conditional<
 
  359      std::is_lvalue_reference<Value>::value,
 
  361      typename std::decay<Value>::type>::type;
 
  365    MapItem( Key && key_, Value && value_ ) : key(std::forward<Key>(key_)), value(std::forward<Value>(value_)) {}
 
  373    template <
class Archive> 
inline 
  376      archive( make_nvp<Archive>(
"key",   key),
 
  377               make_nvp<Archive>(
"value", value) );
 
  384  template <
class KeyType, 
class ValueType> 
inline 
  387    return {std::forward<KeyType>(key), std::forward<ValueType>(value)};
 
  395    namespace{ 
struct version_binding_tag {}; }
 
  401    template <
class T, 
class BindingTag = version_binding_tag> 
struct Version 
  403      static const std::uint32_t version = 0;
 
  411      std::unordered_map<std::size_t, std::uint32_t> mapping;
 
  413      std::uint32_t find( std::size_t hash, std::uint32_t version )
 
  415        const auto result = mapping.emplace( hash, version );
 
  416        return result.first->second;
 
An output archive designed to save data in a compact binary representation.
Definition: binary.hpp:52
 
A wrapper around data that should be serialized after all non-deferred data.
Definition: helpers.hpp:233
 
DeferredData(T &&v)
Constructs a new NameValuePair.
Definition: helpers.hpp:257
 
For holding name value pairs.
Definition: helpers.hpp:140
 
std::enable_if<!std::is_same< Archive,::cereal::BinaryInputArchive >::value &&!std::is_same< Archive,::cereal::BinaryOutputArchive >::value, NameValuePair< T > >::type make_nvp(const char *name, T &&value)
A specialization of make_nvp<> that actually creates an nvp for non-binary archives.
Definition: helpers.hpp:192
 
std::enable_if< std::is_same< Archive,::cereal::BinaryInputArchive >::value||std::is_same< Archive,::cereal::BinaryOutputArchive >::value, T && >::type make_nvp(const char *, T &&value)
A specialization of make_nvp<> that simply forwards the value for binary archives.
Definition: helpers.hpp:179
 
NameValuePair(char const *n, T &&v)
Constructs a new NameValuePair.
Definition: helpers.hpp:165
 
A wrapper around size metadata.
Definition: helpers.hpp:313
 
Definition: helpers.hpp:270
 
MapItem< KeyType, ValueType > make_map_item(KeyType &&key, ValueType &&value)
Create a MapItem so that human readable archives will group keys and values together.
Definition: helpers.hpp:385
 
CEREAL_SIZE_TYPE size_type
The size type used by cereal.
Definition: helpers.hpp:61
 
Preprocessor macros that can customise the cereal library.
 
#define CEREAL_SIZE_TYPE
Determines the data type used for size_type.
Definition: macros.hpp:70
 
#define CEREAL_NOEXCEPT
Defines the CEREAL_NOEXCEPT macro to use instead of noexcept.
Definition: macros.hpp:130
 
Internal polymorphism static object support.
 
A wrapper around data that can be serialized in a binary fashion.
Definition: helpers.hpp:212
 
PT data
pointer to beginning of data
Definition: helpers.hpp:221
 
typename std::conditional< std::is_const< typename std::remove_pointer< typename std::remove_reference< T >::type >::type >::value, const void *, void * >::type PT
Definition: helpers.hpp:217
 
uint64_t size
size in bytes
Definition: helpers.hpp:222
 
An exception class thrown when things go wrong at runtime.
Definition: helpers.hpp:49
 
A wrapper around a key and value for serializing data into maps.
Definition: helpers.hpp:352
 
MapItem(Key &&key_, Value &&value_)
Construct a MapItem from a key and a value.
Definition: helpers.hpp:365
 
void CEREAL_SERIALIZE_FUNCTION_NAME(Archive &archive)
Serialize the MapItem with the NVPs "key" and "value".
Definition: helpers.hpp:374
 
Traits struct for DeferredData.
Definition: helpers.hpp:71
 
Traits struct for NVPs.
Definition: helpers.hpp:70
 
Version information class.
Definition: helpers.hpp:402
 
Holds all registered version information.
Definition: helpers.hpp:410
 
Definition: polymorphic_impl.hpp:696
 
Definition: polymorphic_impl.hpp:747