|
NDDEM
|
The base output archive class. More...
#include <cereal.hpp>
Inheritance diagram for cereal::OutputArchive< ArchiveType, Flags >:Public Member Functions | |
| OutputArchive (ArchiveType *const derived) | |
| Construct the output archive. More... | |
| OutputArchive & | operator= (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 ()=default | |
| OutputArchiveBase (OutputArchiveBase &&) CEREAL_NOEXCEPT | |
| OutputArchiveBase & | operator= (OutputArchiveBase &&) CEREAL_NOEXCEPT |
| virtual | ~OutputArchiveBase () CEREAL_NOEXCEPT=default |
Private Member Functions | |
| template<class T > | |
| void | process (T &&head) |
| Serializes data after calling prologue, then calls epilogue. More... | |
| template<class T , class ... Other> | |
| void | process (T &&head, Other &&... tail) |
| Unwinds to process all data. More... | |
| template<class T > | |
| ArchiveType & | processImpl (virtual_base_class< T > const &b) |
| Serialization of a virtual_base_class wrapper. More... | |
| template<class T > | |
| ArchiveType & | processImpl (base_class< T > const &b) |
| Serialization of a base_class wrapper. More... | |
| template<class T > | |
| ArchiveType & | processImpl (DeferredData< T > const &d) |
| template<class T , PROCESS_IF(member_serialize) > | |
| ArchiveType & | processImpl (T const &t) |
| Member serialization. More... | |
| template<class T , PROCESS_IF(non_member_serialize) > | |
| ArchiveType & | processImpl (T const &t) |
| Non member serialization. More... | |
| template<class T , PROCESS_IF(member_save) > | |
| ArchiveType & | processImpl (T const &t) |
| Member split (save) More... | |
| template<class T , PROCESS_IF(non_member_save) > | |
| ArchiveType & | processImpl (T const &t) |
| Non member split (save) More... | |
| template<class T , PROCESS_IF(member_save_minimal) > | |
| ArchiveType & | processImpl (T const &t) |
| Member split (save_minimal) More... | |
| template<class T , PROCESS_IF(non_member_save_minimal) > | |
| ArchiveType & | processImpl (T const &t) |
| Non member split (save_minimal) More... | |
| template<class T , traits::EnableIf<(Flags &AllowEmptyClassElision), !traits::is_output_serializable< T, ArchiveType >::value, std::is_empty< T >::value > = traits::sfinae> | |
| ArchiveType & | processImpl (T const &) |
| Empty class specialization. More... | |
| template<class T , traits::EnableIf< traits::has_invalid_output_versioning< T, ArchiveType >::value||(!traits::is_output_serializable< T, ArchiveType >::value &&(!(Flags &AllowEmptyClassElision)||((Flags &AllowEmptyClassElision) &&!std::is_empty< T >::value)))> = traits::sfinae> | |
| ArchiveType & | processImpl (T const &) |
| No matching serialization. More... | |
| template<class T > | |
| std::uint32_t | registerClassVersion () |
| Registers a class version with the archive and serializes it if necessary. More... | |
| template<class T , PROCESS_IF(member_versioned_serialize) > | |
| ArchiveType & | processImpl (T const &t) |
| Member serialization. More... | |
| template<class T , PROCESS_IF(non_member_versioned_serialize) > | |
| ArchiveType & | processImpl (T const &t) |
| Non member serialization. More... | |
| template<class T , PROCESS_IF(member_versioned_save) > | |
| ArchiveType & | processImpl (T const &t) |
| Member split (save) More... | |
| template<class T , PROCESS_IF(non_member_versioned_save) > | |
| ArchiveType & | processImpl (T const &t) |
| Non member split (save) More... | |
| template<class T , PROCESS_IF(member_versioned_save_minimal) > | |
| ArchiveType & | processImpl (T const &t) |
| Member split (save_minimal) More... | |
| template<class T , PROCESS_IF(non_member_versioned_save_minimal) > | |
| ArchiveType & | processImpl (T const &t) |
| Non member split (save_minimal) More... | |
Private Attributes | |
| std::vector< std::function< void(void)> > | itsDeferments |
| ArchiveType *const | self |
| std::unordered_set< traits::detail::base_class_id, traits::detail::base_class_id_hash > | itsBaseClassSet |
| A set of all base classes that have been serialized. More... | |
| std::unordered_map< void const *, std::uint32_t > | itsSharedPointerMap |
| Maps from addresses to pointer ids. More... | |
| std::vector< std::shared_ptr< const void > > | itsSharedPointerStorage |
| Copy of shared pointers used in itsSharedPointerMap to make sure they are kept alive. More... | |
| std::uint32_t | itsCurrentPointerId |
| The id to be given to the next pointer. More... | |
| std::unordered_map< char const *, std::uint32_t > | itsPolymorphicTypeMap |
| Maps from polymorphic type name strings to ids. More... | |
| std::uint32_t | itsCurrentPolymorphicTypeId |
| The id to be given to the next polymorphic type name. More... | |
| std::unordered_set< size_type > | itsVersionedTypes |
| Keeps track of classes that have versioning information associated with them. More... | |
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... | |
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.
| ArchiveType | The archive type that derives from OutputArchive |
| Flags | Flags to control advanced functionality. See the Flags enum for more information. |
| 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
| 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
|
inline |
Construct the output archive.
| derived | A pointer to the derived ArchiveType (pass this from the derived archive) |
|
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
|
inline |
Serializes all passed in data.
This is the primary interface for serializing data with an archive
|
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
|
delete |
|
inlineprivate |
Serializes data after calling prologue, then calls epilogue.
|
inlineprivate |
Unwinds to process all data.
|
inlineprivate |
Serialization of a base_class wrapper.
|
inlineprivate |
|
inlineprivate |
Empty class specialization.
|
inlineprivate |
No matching serialization.
Invalid if we have invalid output versioning or we are not output serializable, and either don't allow empty class ellision or allow it but are not serializing an empty class
|
inlineprivate |
Member serialization.
|
inlineprivate |
Non member serialization.
|
inlineprivate |
Member split (save)
|
inlineprivate |
Non member split (save)
|
inlineprivate |
Member split (save_minimal)
|
inlineprivate |
Non member split (save_minimal)
|
inlineprivate |
Member serialization.
Versioning implementation
|
inlineprivate |
Non member serialization.
Versioning implementation
|
inlineprivate |
Member split (save)
Versioning implementation
|
inlineprivate |
Non member split (save)
Versioning implementation
|
inlineprivate |
Member split (save_minimal)
Versioning implementation
|
inlineprivate |
Non member split (save_minimal)
Versioning implementation
|
inlineprivate |
Serialization of a virtual_base_class wrapper.
|
inlineprivate |
Registers a class version with the archive and serializes it if necessary.
If this is the first time this class has been serialized, we will record its version number and serialize that.
| T | The type of the class being serialized |
|
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.
|
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.
|
inline |
Serializes any data marked for deferment using defer.
This will cause any data wrapped in DeferredData to be immediately serialized
|
private |
A set of all base classes that have been serialized.
|
private |
The id to be given to the next pointer.
|
private |
The id to be given to the next polymorphic type name.
|
private |
|
private |
Maps from polymorphic type name strings to ids.
|
private |
Maps from addresses to pointer ids.
|
private |
Copy of shared pointers used in itsSharedPointerMap to make sure they are kept alive.
|
private |
Keeps track of classes that have versioning information associated with them.
|
private |