85 if (
this != &other) m_buffer = other.m_buffer;
95 if (
this != &other) m_buffer = std::move(other.m_buffer);
112 return m_buffer.get() == other.m_buffer.get();
121 return !(*
this == other);
150 bool Empty() const noexcept override;
156 bool EoF() const noexcept override;
162 bool IsReadable() const noexcept override;
170 inline
bool IsWritable() const noexcept {
171 return m_buffer->IsWritable();
179 return m_buffer->HasError();
186 std::size_t
Size() const noexcept override;
198 void Clean() noexcept override;
204 void Clear() noexcept override;
211 inline
void Close() noexcept {
220 bool Drop(
const std::size_t& count)
noexcept override;
227 void Seek(
const std::ptrdiff_t& offset,
const Position& mode)
const noexcept override;
277 bool Read(
const std::size_t& count,
DataType& out)
const noexcept override;
285 bool Read(
const std::size_t& count,
WriteOnly& out)
const noexcept override;
312 bool Peek(
const std::size_t& count,
DataType& out)
const noexcept override;
320 bool Peek(
const std::size_t& count,
WriteOnly& out)
const noexcept override;
325 std::shared_ptr<Ring> m_buffer;
331 inline explicit Consumer(std::shared_ptr<Ring> buffer) noexcept
332 : m_buffer(std::move(buffer)) {}
Read-oriented handle over a shared Ring.
Definition consumer.hxx:53
bool Peek(const std::size_t &count, DataType &out) const noexcept override
Peek bytes into a DataType without advancing the read position.
bool Peek(const std::size_t &count, WriteOnly &out) const noexcept override
Peek bytes into a WriteOnly without advancing the read position.
bool Read(const std::size_t &count, DataType &out) const noexcept override
Non-destructive read into a DataType (advances logical position).
bool Drop(const std::size_t &count) noexcept override
Discard count bytes from the current read position.
Consumer & operator=(Consumer &&other) noexcept
Move assignment.
Definition consumer.hxx:94
Consumer(const Consumer &other) noexcept
Copy constructor.
Definition consumer.hxx:66
bool operator!=(const Consumer &other) const noexcept
Inequality comparison.
Definition consumer.hxx:120
void ReadUntilEoF(WriteOnly &out) const noexcept override
Read all remaining bytes until EoF into a WriteOnly.
~Consumer() noexcept override
Destructor.
void ExtractUntilEoF(DataType &out) noexcept override
Extract all remaining bytes until EoF into a DataType.
std::size_t Size() const noexcept override
Total number of bytes stored in the shared Ring.
bool Read(const std::size_t &count, WriteOnly &out) const noexcept override
Non-destructive read into a WriteOnly (advances logical position).
bool HasError() const noexcept
Whether the shared Ring is in a permanent error state.
Definition consumer.hxx:178
void ExtractUntilEoF(WriteOnly &out) noexcept override
Extract all remaining bytes until EoF into a WriteOnly.
void Seek(const std::ptrdiff_t &offset, const Position &mode) const noexcept override
Move the logical read position for non-destructive reads.
bool operator==(const Consumer &other) const noexcept
Equality comparison.
Definition consumer.hxx:111
bool Extract(const std::size_t &count, WriteOnly &out) noexcept override
Extract bytes into a WriteOnly sink (consumes data from the Ring).
std::size_t AvailableBytes() const noexcept override
Number of bytes available for reading from the current position.
void ReadUntilEoF(DataType &out) const noexcept override
Read all remaining bytes until EoF into a DataType.
Consumer(Consumer &&other) noexcept
Move constructor.
Definition consumer.hxx:72
bool Extract(const std::size_t &count, DataType &out) noexcept override
Extract bytes into a DataType (consumes data from the Ring).
Write-only handle over a shared Ring.
Definition producer.hxx:41
Pure interface for a buffer that can be read but not written.
Definition generic.hxx:164
Pure interface for a buffer that can be written but not read.
Definition generic.hxx:420
Buffer module of the StormByte suite.
std::vector< std::byte > DataType
Primary byte storage type used throughout the buffer API.
Definition typedefs.hxx:62
Position
Forward declaration of the WriteOnly interface.
Definition typedefs.hxx:50
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:28