19 #ifndef OST_IO_BINARY_DATA_SOURCE_HH
20 #define OST_IO_BINARY_DATA_SOURCE_HH
28 #include <boost/type_traits/is_floating_point.hpp>
29 #include <boost/type_traits/is_integral.hpp>
32 namespace ost {
namespace io {
39 template <
typename SERIALIZABLE>
44 template <
typename SERIALIZABLE>
54 std::istream& stream_;
59 template <
bool B,
typename T>
66 value.Serialize(source);
74 source.
Stream().read(
reinterpret_cast<char*
>(&value),
sizeof(T));
83 boost::is_floating_point<T>::value,
88 char* value,
size_t size)
90 sink.
Stream().read(value, size);
95 static char tmp_buf[1024];
97 source.
Stream().read(
reinterpret_cast<char*
>(&str_len),
sizeof(
size_t));
98 source.
Stream().read(tmp_buf, str_len);
99 str.reserve(str_len+1);
100 str.assign(tmp_buf, str_len);
BinaryDataSource & operator&(SERIALIZABLE &object)
BinaryDataSource & operator>>(SERIALIZABLE &object)
BinaryDataSource(std::istream &stream)
void Serialize(BinaryDataSink &sink, const T &value)
void RawSerialize(BinaryDataSink &sink, char *value, size_t size)
SerializeHelper(BinaryDataSource &source, T &value)
SerializeHelper(BinaryDataSource &source, T &value)