cereal
A C++11 library for serialization
Public Member Functions | List of all members
cereal::OutputArchive< ArchiveType, Flags > Class Template Reference

The base output archive class. More...

#include </build/libcereal-SAfJB3/libcereal-1.3.2+dfsg/include/cereal/cereal.hpp>

Inheritance diagram for cereal::OutputArchive< ArchiveType, Flags >:
cereal::detail::OutputArchiveBase

Public Member Functions

 OutputArchive (ArchiveType *const derived)
 Construct the output archive. More...
 
OutputArchiveoperator= (OutputArchive const &)=delete
 
template<class ... Types>
ArchiveType & operator() (Types &&... args)
 Serializes all passed in data. More...
 
void serializeDeferments ()
 Serializes any data marked for deferment using defer. More...
 
std::uint32_t registerSharedPointer (const std::shared_ptr< const void > &sharedPointer)
 Registers a shared pointer with the archive. More...
 
std::uint32_t registerPolymorphicType (char const *name)
 Registers a polymorphic type name with the archive. More...
 
- Public Member Functions inherited from cereal::detail::OutputArchiveBase
 OutputArchiveBase (OutputArchiveBase &&) CEREAL_NOEXCEPT
 
OutputArchiveBaseoperator= (OutputArchiveBase &&) CEREAL_NOEXCEPT
 

Boost Transition Layer

Functionality that mirrors the syntax for Boost. This is useful if you are transitioning a large project from Boost to cereal. The preferred interface for cereal is using operator().

using is_loading = std::false_type
 Indicates this archive is not intended for loading. More...
 
using is_saving = std::true_type
 Indicates this archive is intended for saving. More...
 
template<class T >
ArchiveType & operator& (T &&arg)
 Serializes passed in data. More...
 
template<class T >
ArchiveType & operator<< (T &&arg)
 Serializes passed in data. More...
 

Detailed Description

template<class ArchiveType, std::uint32_t Flags = 0>
class cereal::OutputArchive< ArchiveType, Flags >

The base output archive class.

This is the base output archive for all output archives. If you create a custom archive class, it should derive from this, passing itself as a template parameter for the ArchiveType.

The base class provides all of the functionality necessary to properly forward data to the correct serialization functions.

Individual archives should use a combination of prologue and epilogue functions together with specializations of serialize, save, and load to alter the functionality of their serialization.

Template Parameters
ArchiveTypeThe archive type that derives from OutputArchive
FlagsFlags to control advanced functionality. See the Flags enum for more information.

Member Typedef Documentation

◆ is_loading

template<class ArchiveType , std::uint32_t Flags = 0>
using cereal::OutputArchive< ArchiveType, Flags >::is_loading = std::false_type

Indicates this archive is not intended for loading.

This ensures compatibility with boost archive types. If you are transitioning from boost, you can check this value within a member or external serialize function (i.e., Archive::is_loading::value) to disable behavior specific to loading, until you can transition to split save/load or save_minimal/load_minimal functions

◆ is_saving

template<class ArchiveType , std::uint32_t Flags = 0>
using cereal::OutputArchive< ArchiveType, Flags >::is_saving = std::true_type

Indicates this archive is intended for saving.

This ensures compatibility with boost archive types. If you are transitioning from boost, you can check this value within a member or external serialize function (i.e., Archive::is_saving::value) to enable behavior specific to loading, until you can transition to split save/load or save_minimal/load_minimal functions

Constructor & Destructor Documentation

◆ OutputArchive()

template<class ArchiveType , std::uint32_t Flags = 0>
cereal::OutputArchive< ArchiveType, Flags >::OutputArchive ( ArchiveType *const  derived)
inline

Construct the output archive.

Parameters
derivedA pointer to the derived ArchiveType (pass this from the derived archive)

Member Function Documentation

◆ operator&()

template<class ArchiveType , std::uint32_t Flags = 0>
template<class T >
ArchiveType & cereal::OutputArchive< ArchiveType, Flags >::operator& ( T &&  arg)
inline

Serializes passed in data.

This is a boost compatability layer and is not the preferred way of using cereal. If you are transitioning from boost, use this until you can transition to the operator() overload

◆ operator()()

template<class ArchiveType , std::uint32_t Flags = 0>
template<class ... Types>
ArchiveType & cereal::OutputArchive< ArchiveType, Flags >::operator() ( Types &&...  args)
inline

Serializes all passed in data.

This is the primary interface for serializing data with an archive

◆ operator<<()

template<class ArchiveType , std::uint32_t Flags = 0>
template<class T >
ArchiveType & cereal::OutputArchive< ArchiveType, Flags >::operator<< ( T &&  arg)
inline

Serializes passed in data.

This is a boost compatability layer and is not the preferred way of using cereal. If you are transitioning from boost, use this until you can transition to the operator() overload

◆ registerPolymorphicType()

template<class ArchiveType , std::uint32_t Flags = 0>
std::uint32_t cereal::OutputArchive< ArchiveType, Flags >::registerPolymorphicType ( char const *  name)
inline

Registers a polymorphic type name with the archive.

This function is used to track polymorphic types to prevent unnecessary saves of identifying strings used by the polymorphic support functionality.

◆ registerSharedPointer()

template<class ArchiveType , std::uint32_t Flags = 0>
std::uint32_t cereal::OutputArchive< ArchiveType, Flags >::registerSharedPointer ( const std::shared_ptr< const void > &  sharedPointer)
inline

Registers a shared pointer with the archive.

This function is used to track shared pointer targets to prevent unnecessary saves from taking place if multiple shared pointers point to the same data.

◆ serializeDeferments()

template<class ArchiveType , std::uint32_t Flags = 0>
void cereal::OutputArchive< ArchiveType, Flags >::serializeDeferments ( )
inline

Serializes any data marked for deferment using defer.

This will cause any data wrapped in DeferredData to be immediately serialized


The documentation for this class was generated from the following file: