19 #ifndef OST_IO_BINARY_DATA_SINK_HH
20 #define OST_IO_BINARY_DATA_SINK_HH
31 namespace ost {
namespace io {
38 template <
typename SERIALIZABLE>
43 template <
typename SERIALIZABLE>
53 std::ostream& stream_;
58 template <
bool B,
typename T>
65 value.Serialize(sink);
73 sink.
Stream().write(
reinterpret_cast<char*
>(&value),
sizeof(T));
82 boost::is_floating_point<T>::value,
83 T>(sink,
const_cast<T&
>(value));
89 sink.
Stream().write(
reinterpret_cast<char*
>(value), size);
93 size_t str_len=str.length();
94 sink.
Stream().write(
reinterpret_cast<char*
>(&str_len),
sizeof(
size_t));
95 sink.
Stream().write(str.c_str(), str.length());
BinaryDataSink(std::ostream &stream)
BinaryDataSink & operator&(SERIALIZABLE object)
BinaryDataSink & operator<<(SERIALIZABLE object)
void Serialize(BinaryDataSink &sink, const T &value)
void RawSerialize(BinaryDataSink &sink, char *value, size_t size)
SerializeWriteHelper(BinaryDataSink &sink, T &value)
SerializeWriteHelper(BinaryDataSink &sink, T &value)