21 namespace illumina {
namespace interop {
namespace io
33 in.read(reinterpret_cast<char *>(buffer), n *
sizeof(
T));
55 std::memcpy(reinterpret_cast<char *>(buffer), in, n *
sizeof(
T));
92 return static_cast<std::streamsize
>(
sizeof(
T));
115 void read_binary(std::istream &in, std::vector<T> &buffer,
const size_t n)
139 inline void read_binary(std::istream &in, std::string &str,
const std::string& default_val)
141 const size_t length = read_binary< ::uint16_t >(in);
145 str.assign(length,
' ');
146 read_binary(in, const_cast<char *>(str.c_str()), length);
148 else str = default_val;
160 out.write(reinterpret_cast<const char *>(buffer), n *
sizeof(
T));
181 void write_binary(std::ostream &out,
const std::vector<T> &buffer,
const size_t n)
183 if(buffer.empty())
return;
205 const ::uint16_t len =
static_cast< ::uint16_t
>(str.size());
207 if (len > 0)
write_binary(out, const_cast<char *>(str.c_str()), len);
215 inline std::streamsize
scount(std::istream &in)
225 inline std::streamsize
scount(std::ostream &out)
Definition: enum_description.h:15
#define INTEROP_THROW(EXCEPTION, MESSAGE)
Definition: exception.h:18
#define INTEROP_ASSERT(TST)
Definition: assert.h:21
void write_binary(std::ostream &out, const T *buffer, const size_t n)
Definition: stream_util.h:158
std::streamsize scount(std::istream &in)
Definition: stream_util.h:215
std::streamsize read_binary_with_count(std::istream &in, T &buffer)
Definition: stream_util.h:76
Definition: stream_exceptions.h:73
void read_binary(std::istream &in, T *buffer, const size_t n)
Definition: stream_util.h:31