Go to the documentation of this file.
18 namespace serialization
28 std::vector<uint8_t>&
m_v;
34 size_t write(
const void* d,
size_t n)
override
36 const size_t idx = m_v.size();
41 size_t read(
void* d,
size_t n)
override
43 const int avail =
static_cast<int>(m_v.size()) - m_pos_read;
44 if (avail <
static_cast<int>(
n))
45 throw std::runtime_error(
46 "CArchiveStreamBase: EOF reading from std::vector!");
56 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!");
size_t write(const void *d, size_t n) override
Writes a block of bytes.
CArchive for mrpt::io::CStream classes (use as template argument).
size_t read(void *d, size_t n) override
Reads a block of bytes.
CArchiveStreamBase(std::vector< uint8_t > &v)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
const std::vector< uint8_t > & m_v
size_t write(const void *d, size_t n) override
Writes a block of bytes.
size_t read(void *d, size_t n) override
Reads a block of bytes.
std::vector< uint8_t > & m_v
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)
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |