|
cereal_fwd
Fork of cereal library adding archive supporting forward compatibility
|
An input archive designed to load data saved using ExtendableBinaryOutputArchive. More...
#include </home/breiker/code/git/cereal_fwd_github/include/cereal/archives/extendable_binary.hpp>
Classes | |
| class | Options |
| A class containing various advanced options for the ExtendableBinaryInput archive. More... | |
Public Member Functions | |
| ExtendableBinaryInputArchive (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... | |
| template<std::size_t DataSize> | |
| void | loadBinarySingle (void *const data, std::size_t size) |
| Load least significant size bytes of type which sizeof is DataSize. More... | |
| template<std::size_t DataSize> | |
| void | copyBinarySingleNoSwap (void *dest_, void *const src_, std::size_t size_) |
| Copies size bytes from input buffer to the output buffer without any byte order swapping. More... | |
| void | skipData (std::size_t size) |
| Discards size bytes from the input stream. More... | |
| bool | loadTypeTag () |
| Load type tag from input stream. More... | |
| template<extendable_binary_detail::FieldType expected_type> | |
| auto | getTypeTag () -> decltype(extendable_binary_detail::readType(std::uint8_t |
| Gets last type tag loaded from input stream. More... | |
| if (lastTypeTag.first !=expected_type &&lastTypeTag.first !=FieldType::omitted_field) throw Exception("Loaded wrong lastTypeTag | |
| template<extendable_binary_detail::FieldType expected_type> | |
| auto | getTypeTagNoError () noexcept -> decltype(extendable_binary_detail::readType(std::uint8_t |
| Gets last type tag loaded from input stream. More... | |
| template<class T > | |
| void | loadVarint (T &v) |
| Load varint from the stream. More... | |
| void | skipVarint () |
| Load varint from the stream, discard input value. | |
| void | loadObjectBeginning () |
| Load metadata of new object. | |
| void | loadEndOfObjectData () |
| Read all remaining data from current object. More... | |
| void | loadOmittedObject () |
| Read/Skip object which was not loaded explicitly. | |
| std::uint32_t | getLoadedClassVersion () const |
| Gets last loaded class version. | |
| std::int32_t | getLoadedPolymorphicId () const |
| Gets last loaded polymorphic id. | |
| const std::string & | getLoadedPolymorphicName () const |
| Gets last loaded polymorphic name. | |
| std::uint32_t | getLoadedObjectId () const |
| Gets last loaded object id for shared pointers. | |
| bool | getLoadedPointerValidity () const |
| Returns if last pointer was not nullptr. | |
| void | setLastSizeTag (std::size_t size) |
| Sets value of loaded size tag. | |
| std::size_t | getLastSizeTag () const |
| Returns value of last loaded size tag. | |
Public Member Functions inherited from cereal::InputArchive< ExtendableBinaryInputArchive, Flags::ForwardSupport > | |
| InputArchive (ExtendableBinaryInputArchive *const derived) | |
| Construct the input archive. More... | |
| InputArchive & | operator= (InputArchive const &)=delete |
| ExtendableBinaryInputArchive & | operator() (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... | |
| bool | wasSerialized () const |
| Indicates if last field was loaded. More... | |
| ExtendableBinaryInputArchive & | operator& (T &&arg) |
| Serializes passed in data. More... | |
| ExtendableBinaryInputArchive & | operator>> (T &&arg) |
| Serializes passed in data. More... | |
Public Member Functions inherited from cereal::detail::InputArchiveBase | |
| InputArchiveBase (InputArchiveBase &&) CEREAL_NOEXCEPT | |
| InputArchiveBase & | operator= (InputArchiveBase &&) CEREAL_NOEXCEPT |
Public Attributes | |
| expected | __pad0__: " + std::to_string(static_cast<int>(expected_type)) + " got: " + std::to_string(static_cast<int>(lastTypeTag.first)) ) |
| return | lastTypeTag |
Additional Inherited Members | |
Public Types inherited from cereal::InputArchive< ExtendableBinaryInputArchive, Flags::ForwardSupport > | |
| using | is_saving = std::false_type |
| indicates if archive is used for saving | |
| using | is_loading = std::true_type |
| indicates if archive is used for loading | |
An input archive designed to load data saved using ExtendableBinaryOutputArchive.
This archive outputs data to a stream in an compact binary representation with additional metadata needed to support forward and backward compatibility.
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, but causes no performance hit if swapping is not necessary.
The archive will save all integer values as variadic integers. Exception will be thrown when on deserialization value will be bigger than can be stored to target field. It is still recommended to use fixed size integers.
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.
|
inline |
Construct, loading from the provided stream.
| stream | The stream to read from. Should be opened with std::ios::binary flag. |
| options | The ExtendableBinary specific options to use. See the Options struct for the values of default parameters |
|
inline |
Copies size bytes from input buffer to the output buffer without any byte order swapping.
Used for loading least significant size_ bytes from integer of DataSize size.
| DataSize | size of destination type |
| dest_ | destination address |
| src_ | source address |
| size_ | number of bytes to copy |
|
inline |
Gets last type tag loaded from input stream.
Throws Exception if type is not expected_type or omitted.
| expected_type | type which is expected to be loaded |
|
inlinenoexcept |
Gets last type tag loaded from input stream.
| expected_type | type which is expected to be loaded |
|
inline |
Reads size bytes of data from the input stream.
| data | The data to save |
| size | The number of bytes in the data |
| DataSize | T The size of the actual type of the data elements being loaded |
|
inline |
Load least significant size bytes of type which sizeof is DataSize.
Size has to be less than DataSize. Used to load integers using minimal number of bytes. Throws Exception if size bytes cannot be loaded from stream.
| data | The data to save |
| size | The number of bytes in the data |
| DataSize | T The size of the actual type of the data elements being loaded |
|
inline |
Read all remaining data from current object.
Tries to read end of object tag. Any unknown fields which were not loaded explicitly are skipped.
|
inline |
Load type tag from input stream.
Type is saved to lastTypeTag field and can be accessed with getTypeTag() method.
|
inline |
Load varint from the stream.
Based on Protocol Buffers usage.
|
inline |
Discards size bytes from the input stream.
| size | The number of bytes to skip Throws Exception if not enough bytes are read |
| return cereal::ExtendableBinaryInputArchive::lastTypeTag |
1.8.13