cereal
A C++11 library for serialization
 All Classes Files Functions Variables Typedefs Enumerations Groups
Public Member Functions | List of all members
cereal::InputArchive< ArchiveType, Flags > Class Template Reference

The base input archive class. More...

#include <cereal/cereal.hpp>

Inheritance diagram for cereal::InputArchive< ArchiveType, Flags >:
cereal::detail::InputArchiveBase

Public Member Functions

 InputArchive (ArchiveType *const self)
 Construct the output archive. More...
 
template<class... Types>
ArchiveType & operator() (Types &&...args)
 Serializes all passed in data.
 
std::shared_ptr< void > getSharedPointer (std::uint32_t const id)
 Retrieves a shared pointer given a unique key for it. More...
 
void registerSharedPointer (std::uint32_t const id, std::shared_ptr< void > ptr)
 Registers a shared pointer to its unique identifier. More...
 
std::string getPolymorphicName (std::uint32_t const id)
 Retrieves the string for a polymorphic type given a unique key for it. More...
 
void registerPolymorphicName (std::uint32_t const id, std::string const &name)
 Registers a polymorphic name string to its unique identifier. More...
 

Detailed Description

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

The base input archive class.

This is the base input archive for all input 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 InputArchive
FlagsFlags to control advanced functionality. See the Flags enum for more information.

Constructor & Destructor Documentation

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

Construct the output archive.

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

Member Function Documentation

template<class ArchiveType, std::uint32_t Flags = 0>
std::string cereal::InputArchive< ArchiveType, Flags >::getPolymorphicName ( std::uint32_t const  id)
inline

Retrieves the string for a polymorphic type given a unique key for it.

This is used to retrieve a string previously registered during a polymorphic load.

Parameters
idThe unique id that was serialized for the polymorphic type
Returns
The string identifier for the tyep
template<class ArchiveType, std::uint32_t Flags = 0>
std::shared_ptr<void> cereal::InputArchive< ArchiveType, Flags >::getSharedPointer ( std::uint32_t const  id)
inline

Retrieves a shared pointer given a unique key for it.

This is used to retrieve a previously registered shared_ptr which has already been loaded.

Parameters
idThe unique id that was serialized for the pointer
Returns
A shared pointer to the data
template<class ArchiveType, std::uint32_t Flags = 0>
void cereal::InputArchive< ArchiveType, Flags >::registerPolymorphicName ( std::uint32_t const  id,
std::string const &  name 
)
inline

Registers a polymorphic name string to its unique identifier.

After a polymorphic type has been loaded for the first time, it should be registered with its loaded id for future references to it.

Parameters
idThe unique identifier for the polymorphic type
nameThe name associated with the tyep
template<class ArchiveType, std::uint32_t Flags = 0>
void cereal::InputArchive< ArchiveType, Flags >::registerSharedPointer ( std::uint32_t const  id,
std::shared_ptr< void >  ptr 
)
inline

Registers a shared pointer to its unique identifier.

After a shared pointer has been loaded for the first time, it should be registered with its loaded id for future references to it.

Parameters
idThe unique identifier for the shared pointer
ptrThe actual shared pointer

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