26 std::vector<uint8_t>&
m_v;
33 size_t write(
const void* d,
size_t n)
override 35 const size_t idx = m_v.size();
40 size_t read(
void* d,
size_t n)
override 42 const int avail =
static_cast<int>(m_v.size()) - m_pos_read;
43 if (avail < static_cast<int>(n))
44 throw std::runtime_error(
45 "CArchiveStreamBase: EOF reading from std::vector!");
55 const std::vector<uint8_t>&
m_v;
62 size_t write(
const void* d,
size_t n)
override 64 throw std::runtime_error(
65 "CArchiveStreamBase: Attempt to write to read-only vector.");
67 size_t read(
void* d,
size_t n)
override 69 const int avail =
static_cast<int>(m_v.size()) - m_pos_read;
70 if (avail < static_cast<int>(n))
71 throw std::runtime_error(
72 "CArchiveStreamBase: EOF reading from std::vector!");
CArchiveStreamBase(std::vector< uint8_t > &v)
const std::vector< uint8_t > & m_v
size_t read(void *d, size_t n) override
Reads a block of bytes.
size_t read(void *d, size_t n) override
Reads a block of bytes.
CArchive for mrpt::io::CStream classes (use as template argument).
Virtual base class for "archives": classes abstracting I/O streams.
size_t write(const void *d, size_t n) override
Writes a block of bytes.
std::vector< uint8_t > & m_v
size_t write(const void *d, size_t n) override
Writes a block of bytes.
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".
CArchiveStreamBase(const std::vector< uint8_t > &v)