15 #include "../config/config.hpp"
30 inline void write(std::ostream& os, T value)
32 os.write((
char*) &value,
sizeof(T));
37 inline T
read(std::istream& is)
40 is.read((
char*) &value,
sizeof(T));
46 inline T
read(
const char *buf)
49 std::copy(buf, buf +
sizeof(T), reinterpret_cast<char*>(&value));
57 const char *ptr =
reinterpret_cast<const char*
>(&val);
58 vec.insert(vec.end(), ptr, ptr +
sizeof(T));
63 void WriteBase64(std::ostream &
out,
const void *bytes,
size_t nbytes);
67 void DecodeBase64(
const char *src,
size_t len, std::vector<char> &buf);
void DecodeBase64(const char *src, size_t len, std::vector< char > &buf)
void write(std::ostream &os, T value)
Write 'value' to stream.
void WriteBase64(std::ostream &out, const void *bytes, size_t nbytes)
T read(std::istream &is)
Read a value from the stream and return it.
size_t NumBase64Chars(size_t nbytes)
void AppendBytes(std::vector< char > &vec, const T &val)
Append the binary representation of val to the byte buffer vec.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...