checkpoint::BaseSerializer struct

General base class for serialiers.

Derived classes

struct Footprinter
struct MemorySerializer
struct Sizer
Sizer serializers for sizing the contents of classes as a preprocessing pass before packing content so a properly sized buffer can be allocated.
template<typename StreamT = std::ostream>
struct StreamPacker
template<typename StreamT = std::istream>
struct StreamUnpacker

Public types

using ModeType = eSerializationMode
template<typename SerializerT, typename T>
using DispatcherType = dispatch::BasicDispatcher<SerializerT, T>

Constructors, destructors, conversion operators

BaseSerializer(ModeType const& in_mode) explicit
Construct a base serializer.

Public functions

auto getMode() const -> ModeType
Get the serializer mode.
auto isSizing() const -> bool
Check if the serializer is sizing.
auto isPacking() const -> bool
Check if the serializer is packing.
auto isUnpacking() const -> bool
Check if the serializer is unpacking.
auto isFootprinting() const -> bool
Check if the serializer is footprinting.
template<typename T>
void countBytes(T const&)
Count bytes for footprinting—default empty implementation.
void addBytes(std::size_t)
Add bytes for footprinting—default empty implementation.
void contiguousBytes(void*, SerialSizeType, SerialSizeType)
Add contiguous bytes to the sizer.
auto usedBufferSize() -> SerialSizeType
Returns size of buffer (in bytes) used during given serialization step. By default it returns 0.
template<typename SerializerT, typename T>
void contiguousTyped(SerializerT& serdes, T* ptr, SerialSizeType num_elms)
Serialize a contiguous set of typed bytes.
template<typename... Args>
void skip(Args&& ...)
Tell the serializer that some data is skipped in the traversal.
auto getBuffer() const -> SerialByteType*
Get a buffer if it is associated with the serializer.
auto getSpotIncrement(SerialSizeType const) -> SerialByteType*
Get the current spot in the buffer and then increment by some number of bytes.
auto isVirtualDisabled() const -> bool
Check if virtual serialization is disabled.
void setVirtualDisabled(bool val)
Set whether virtual serialization is enabled/disabled.

Protected variables

ModeType cur_mode_
bool virtual_disabled_

Function documentation

checkpoint::BaseSerializer::BaseSerializer(ModeType const& in_mode) explicit

Construct a base serializer.

Parameters
in_mode in The serializer mode

ModeType checkpoint::BaseSerializer::getMode() const

Get the serializer mode.

Returns the serializer mode

bool checkpoint::BaseSerializer::isSizing() const

Check if the serializer is sizing.

Returns if it is sizing

bool checkpoint::BaseSerializer::isPacking() const

Check if the serializer is packing.

Returns if it is packing

bool checkpoint::BaseSerializer::isUnpacking() const

Check if the serializer is unpacking.

Returns if it is unpacking

bool checkpoint::BaseSerializer::isFootprinting() const

Check if the serializer is footprinting.

Returns if it is footprinting

template<typename SerializerT, typename T>
void checkpoint::BaseSerializer::contiguousTyped(SerializerT& serdes, T* ptr, SerialSizeType num_elms)

Serialize a contiguous set of typed bytes.

Parameters
serdes in the serializer
ptr in pointer to a typed element T
num_elms in the number of elements

template<typename... Args>
void checkpoint::BaseSerializer::skip(Args&& ...)

Tell the serializer that some data is skipped in the traversal.

SerialByteType* checkpoint::BaseSerializer::getBuffer() const

Get a buffer if it is associated with the serializer.

Returns pointer to the char* buffer

SerialByteType* checkpoint::BaseSerializer::getSpotIncrement(SerialSizeType const)

Get the current spot in the buffer and then increment by some number of bytes.

Returns the current spot

bool checkpoint::BaseSerializer::isVirtualDisabled() const

Check if virtual serialization is disabled.

Returns whether virtual serialization is disabled

void checkpoint::BaseSerializer::setVirtualDisabled(bool val)

Set whether virtual serialization is enabled/disabled.

Parameters
val in whether virtual serialization is disabled

Variable documentation

ModeType checkpoint::BaseSerializer::cur_mode_ protected

The current mode

bool checkpoint::BaseSerializer::virtual_disabled_ protected

Virtual serialization disabled