cereal
A C++11 library for serialization
Files | Classes | Macros | Enumerations | Functions
Internal Functionality

Various classes and functions that are critical for the operation of cereal but of no interest to users. More...

Files

file  helpers.hpp
 Internal helper functionality.
 
file  polymorphic_impl.hpp
 Internal polymorphism support.
 
file  polymorphic_impl_fwd.hpp
 Internal polymorphism support forward declarations.
 
file  static_object.hpp
 Internal polymorphism static object support.
 
file  traits.hpp
 Internal type trait support.
 
file  util.hpp
 Internal misc utilities.
 

Classes

class  cereal::OutputArchive< ArchiveType, Flags >
 The base output archive class. More...
 
class  cereal::InputArchive< ArchiveType, Flags >
 The base input archive class. More...
 

Macros

#define CEREAL_REGISTER_ARCHIVE(Archive)
 Registers a specific Archive type with cereal. More...
 

Enumerations

enum  cereal::Flags { AllowEmptyClassElision = 1 }
 Special flags for archives. More...
 

Functions

std::uint8_t cereal::portable_binary_detail::is_little_endian ()
 Returns true if the current machine is little endian.
 
template<std::size_t DataSize>
void cereal::portable_binary_detail::swap_bytes (std::uint8_t *data)
 Swaps the order of bytes for some chunk of memory. More...
 
template<class Archive , class T >
void cereal::prologue (Archive &, T const &)
 
template<class Archive , class T >
void cereal::epilogue (Archive &, T const &)
 

Detailed Description

Various classes and functions that are critical for the operation of cereal but of no interest to users.

Macro Definition Documentation

◆ CEREAL_REGISTER_ARCHIVE

#define CEREAL_REGISTER_ARCHIVE (   Archive)
Value:
namespace cereal { namespace detail { \
template <class T, class BindingTag> \
typename polymorphic_serialization_support<Archive, T>::type \
instantiate_polymorphic_binding( T*, Archive*, BindingTag, adl_tag ); \
} } /* end namespaces */

Registers a specific Archive type with cereal.

This registration should be done once per archive. A good place to put this is immediately following the definition of your archive. Archive registration is only strictly necessary if you wish to support pointers to polymorphic data types. All archives that come with cereal are already registered.

Enumeration Type Documentation

◆ Flags

Special flags for archives.

AllowEmptyClassElision This allows for empty classes to be serialized even if they do not provide a serialization function. Classes with no data members are considered to be empty. Be warned that if this is enabled and you attempt to serialize an empty class with improperly formed serialize or load/save functions, no static error will occur - the error will propogate silently and your intended serialization functions may not be called. You can manually ensure that your classes that have custom serialization are correct by using the traits is_output_serializable and is_input_serializable in cereal/details/traits.hpp.

Function Documentation

◆ epilogue()

template<class Archive , class T >
void cereal::epilogue ( Archive &  ,
T const &   
)
inline

Called after a type is serialized to tear down any special archive state for processing some type

◆ prologue()

template<class Archive , class T >
void cereal::prologue ( Archive &  ,
T const &   
)
inline

Called before a type is serialized to set up any special archive state for processing some type

If designing a serializer that needs to set up any kind of special state or output extra information for a type, specialize this function for the archive type and the types that require the extra information.

◆ swap_bytes()

template<std::size_t DataSize>
void cereal::portable_binary_detail::swap_bytes ( std::uint8_t *  data)
inline

Swaps the order of bytes for some chunk of memory.

Parameters
dataThe data as a uint8_t pointer
Template Parameters
DataSizeThe true size of the data