cereal
A C++11 library for serialization
|
Go to the documentation of this file.
29 #ifndef CEREAL_ARCHIVES_BINARY_HPP_
30 #define CEREAL_ARCHIVES_BINARY_HPP_
65 void saveBinary( const
void * data, std::streamsize size )
67 auto const writtenSize = itsStream.rdbuf()->sputn(
reinterpret_cast<const char*
>( data ), size );
69 if(writtenSize != size)
70 throw Exception(
"Failed to write " + std::to_string(size) +
" bytes to output stream! Wrote " + std::to_string(writtenSize));
74 std::ostream & itsStream;
102 auto const readSize = itsStream.rdbuf()->sgetn(
reinterpret_cast<char*
>( data ), size );
105 throw Exception(
"Failed to read " + std::to_string(size) +
" bytes from input stream! Read " + std::to_string(readSize));
109 std::istream & itsStream;
116 template<
class T>
inline
117 typename std::enable_if<std::is_arithmetic<T>::value,
void>::type
124 template<
class T>
inline
125 typename std::enable_if<std::is_arithmetic<T>::value,
void>::type
132 template <
class Archive,
class T>
inline
140 template <
class Archive,
class T>
inline
148 template <
class T>
inline
155 template <
class T>
inline
169 #endif // CEREAL_ARCHIVES_BINARY_HPP_
An output archive designed to save data in a compact binary representation.
Definition: binary.hpp:51
uint64_t size
size in bytes
Definition: helpers.hpp:222
#define CEREAL_ARCHIVE_RESTRICT(INTYPE, OUTTYPE)
A macro to use to restrict which types of archives your function will work for.
Definition: traits.hpp:1315
#define CEREAL_SERIALIZE_FUNCTION_NAME
The serialization/deserialization function name to search for.
Definition: macros.hpp:78
void saveBinary(const void *data, std::streamsize size)
Writes size bytes of data to the output stream.
Definition: binary.hpp:65
PT data
pointer to beginning of data
Definition: helpers.hpp:221
#define CEREAL_LOAD_FUNCTION_NAME
The deserialization (load) function name to search for.
Definition: macros.hpp:85
#define CEREAL_REGISTER_ARCHIVE(Archive)
Registers a specific Archive type with cereal.
Definition: cereal.hpp:195
For holding name value pairs.
Definition: helpers.hpp:139
The base output archive class.
Definition: cereal.hpp:318
#define CEREAL_SAVE_FUNCTION_NAME
The serialization (save) function name to search for.
Definition: macros.hpp:92
#define CEREAL_SETUP_ARCHIVE_TRAITS(InputArchive, OutputArchive)
Sets up traits that relate an input archive to an output archive.
Definition: traits.hpp:169
A wrapper around data that can be serialized in a binary fashion.
Definition: helpers.hpp:211
#define CEREAL_NOEXCEPT
Defines the CEREAL_NOEXCEPT macro to use instead of noexcept.
Definition: macros.hpp:130
Main cereal functionality.
A wrapper around size metadata.
Definition: helpers.hpp:312
An exception class thrown when things go wrong at runtime.
Definition: helpers.hpp:48
BinaryOutputArchive(std::ostream &stream)
Construct, outputting to the provided stream.
Definition: binary.hpp:57