1 #ifndef GENESIS_UTILS_IO_SERIALIZER_H_ 2 #define GENESIS_UTILS_IO_SERIALIZER_H_ 72 : outstream (outstream)
84 inline operator bool()
const 94 inline bool eof()
const 137 char* buffer =
new char[n];
138 std::fill(buffer, buffer+n,
'\0');
164 size_t len = v.length();
175 outstream.write( reinterpret_cast<char const*>( &v ),
sizeof(v));
214 #endif // include guard
void put_plain(const T v)
Write plain data to the stream, by casting it to a char array.
Serializer(std::ostream &outstream)
void file_output_stream(std::string const &filename, std::ofstream &out_stream, std::ios_base::openmode mode=std::ios_base::out)
Helper function to obtain an output stream to a file.
void put_null(const size_t n)
Write n zero bytes (\0) to the stream.
void put_raw_string(const std::string &v)
Write raw data, provided as a string, to the stream, without writing its length.
Serializer(std::string const &filename)
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
Provides some valuable additions to STD.
void put_raw(char const *data, size_t n)
Write raw data, provided as a char array of length n, to the stream.
void put_float(const T v)
Write a floating point number to the stream.
void put_string(const std::string &v)
Write a string, preceded by its length, to the stream. Use get_string() to read it.
void put_int(const T v)
Write an integer number to the stream.