|
| enum | cereal::Flags { AllowEmptyClassElision = 1,
ForwardSupport = 2
} |
| | Special flags for archives. More...
|
| |
Various classes and functions that are critical for the operation of cereal but of no interest to users
◆ CEREAL_REGISTER_ARCHIVE
| #define CEREAL_REGISTER_ARCHIVE |
( |
|
Archive | ) |
|
Value:namespace cereal {
namespace detail { \
template <class T, class BindingTag> \
typename polymorphic_serialization_support<Archive, T>::type \
instantiate_polymorphic_binding( T*, Archive*, BindingTag, adl_tag ); \
} }
Definition: access.hpp:40
Registers a specific Archive type with cereal.
This registration should be done once per archive. A good place to put this is immediately following the definition of your archive. Archive registration is only strictly necessary if you wish to support pointers to polymorphic data types. All archives that come with cereal are already registered.
◆ Flags
Special flags for archives.
AllowEmptyClassElision This allows for empty classes to be serialized even if they do not provide a serialization function. Classes with no data members are considered to be empty. Be warned that if this is enabled and you attempt to serialize an empty class with improperly formed serialize or load/save functions, no static error will occur - the error will propagate silently and your intended serialization functions may not be called. You can manually ensure that your classes that have custom serialization are correct by using the traits is_output_serializable and is_input_serializable in cereal/details/traits.hpp. ForwardSupport
- Saves class version for every object. Even if version was alredy saved for same class. It's needed if first time field which has version information attached is not read and later for the same type we don't have a way to get it since version was saved only once.
- See also
- registerClassVersionImpl
- Calls prologueLoad instead of prologue for input archive.
- See also
- prologueLoad function.
◆ epilogue()
template<class Archive , class T >
| void cereal::epilogue |
( |
Archive & |
, |
|
|
T const & |
|
|
) |
| |
|
inline |
Called after a type is serialized to tear down any special archive state for processing some type
◆ is_little_endian() [1/2]
| std::uint8_t cereal::portable_binary_detail::is_little_endian |
( |
| ) |
|
|
inline |
Returns true if the current machine is little endian.
◆ is_little_endian() [2/2]
| std::uint8_t cereal::extendable_binary_detail::is_little_endian |
( |
| ) |
|
|
inline |
Returns true if the current machine is little endian.
◆ prologue()
template<class Archive , class T >
| void cereal::prologue |
( |
Archive & |
, |
|
|
T const & |
|
|
) |
| |
|
inline |
Called before a type is serialized to set up any special archive state for processing some type
If designing a serializer that needs to set up any kind of special state or output extra information for a type, specialize this function for the archive type and the types that require the extra information.
◆ prologueLoad()
template<class Archive , class T >
| FieldSerialized cereal::prologueLoad |
( |
Archive & |
, |
|
|
T const & |
|
|
) |
| |
|
inline |
Called before a type is serialized (only load) to set up any special archive state for processing some type
If designing a serializer that needs to set up any kind of special state or output extra information for a type, specialize this function for the archive type and the types that require the extra information.
Called instead of prologue for input archives if ForwardSupport flag is set. If function returns false serialize function and epilogue will not be called. It is needed to implement OmittedFieldTag which allows not having to save fields in newer versions without breaking forward compatibility. Making additional tag is needed because some archives relies on field order for correct loading.
- Returns
- if serialize and epilogue function should be called
◆ swap_bytes() [1/2]
template<std::size_t DataSize>
| void cereal::portable_binary_detail::swap_bytes |
( |
std::uint8_t * |
data | ) |
|
|
inline |
Swaps the order of bytes for some chunk of memory.
- Parameters
-
| data | The data as a uint8_t pointer |
- Template Parameters
-
| DataSize | The true size of the data |
◆ swap_bytes() [2/2]
template<std::size_t DataSize>
| void cereal::extendable_binary_detail::swap_bytes |
( |
std::uint8_t * |
data | ) |
|
|
inline |
Swaps the order of bytes for some chunk of memory.
- Parameters
-
| data | The data as a uint8_t pointer |
- Template Parameters
-
| DataSize | The true size of the data |