cereal
A C++11 library for serialization
Classes | Public Member Functions | List of all members
cereal::PortableBinaryInputArchive Class Reference

An input archive designed to load data saved using PortableBinaryOutputArchive. More...

#include </home/shane/workspace/cereal/include/cereal/archives/portable_binary.hpp>

Inheritance diagram for cereal::PortableBinaryInputArchive:
cereal::InputArchive< PortableBinaryInputArchive, AllowEmptyClassElision > cereal::detail::InputArchiveBase

Classes

class  Options
 A class containing various advanced options for the PortableBinaryInput archive. More...
 

Public Member Functions

 PortableBinaryInputArchive (std::istream &stream, Options const &options=Options::Default())
 Construct, loading from the provided stream. More...
 
template<std::size_t DataSize>
void loadBinary (void *const data, std::size_t size)
 Reads size bytes of data from the input stream. More...
 
- Public Member Functions inherited from cereal::InputArchive< PortableBinaryInputArchive, AllowEmptyClassElision >
 InputArchive (PortableBinaryInputArchive *const derived)
 Construct the output archive. More...
 
InputArchiveoperator= (InputArchive const &)=delete
 
PortableBinaryInputArchiveoperator() (Types &&...args)
 Serializes all passed in data. More...
 
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...
 
PortableBinaryInputArchiveoperator& (T &&arg)
 Serializes passed in data. More...
 
PortableBinaryInputArchiveoperator>> (T &&arg)
 Serializes passed in data. More...
 
- Public Member Functions inherited from cereal::detail::InputArchiveBase
 InputArchiveBase (InputArchiveBase &&) CEREAL_NOEXCEPT
 
InputArchiveBaseoperator= (InputArchiveBase &&) CEREAL_NOEXCEPT
 

Additional Inherited Members

- Public Types inherited from cereal::InputArchive< PortableBinaryInputArchive, AllowEmptyClassElision >
using is_loading = std::true_type
 Indicates this archive is intended for loading. More...
 
using is_saving = std::false_type
 Indicates this archive is not intended for saving. More...
 

Detailed Description

An input archive designed to load data saved using PortableBinaryOutputArchive.

This archive outputs data to a stream in an extremely compact binary representation with as little extra metadata as possible.

This archive will load the endianness of the serialized data and if necessary transform it to match that of the local machine. This comes at a significant performance cost compared to non portable archives if the transformation is necessary, and also causes a small performance hit even if it is not necessary.

It is recommended to use portable archives only if you know that you will be sending binary data to machines with different endianness.

The archive will do nothing to ensure types are the same size - that is the responsibility of the user.

When using a binary archive and a file stream, you must use the std::ios::binary format flag to avoid having your data altered inadvertently.

Warning
This archive has not been thoroughly tested across different architectures. Please report any issues, optimizations, or feature requests at the project github.

Constructor & Destructor Documentation

cereal::PortableBinaryInputArchive::PortableBinaryInputArchive ( std::istream &  stream,
Options const &  options = Options::Default() 
)
inline

Construct, loading from the provided stream.

Parameters
streamThe stream to read from. Should be opened with std::ios::binary flag.
optionsThe PortableBinary specific options to use. See the Options struct for the values of default parameters

Member Function Documentation

template<std::size_t DataSize>
void cereal::PortableBinaryInputArchive::loadBinary ( void *const  data,
std::size_t  size 
)
inline

Reads size bytes of data from the input stream.

Parameters
dataThe data to save
sizeThe number of bytes in the data
Template Parameters
DataSizeT The size of the actual type of the data elements being loaded

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