44#include <StormByte/type_traits/safe.hxx>
47#include <StormByte/safe/owner.hxx>
48#include <StormByte/type_traits.hxx>
140 bool operator==(const
Consumer& other) const noexcept;
147 inline
bool operator!=(const
Consumer& other) const noexcept {
148 return !(*
this == other);
178 bool Empty() const noexcept override;
184 bool EoF() const noexcept override;
197 return Storage().IsWritable();
205 return Storage().HasError();
260 void Seek(
const std::ptrdiff_t& offset,
const Position& mode)
const noexcept override;
374 Ring& Storage() const noexcept;
const StormByte::Safe::Binary & Data() const noexcept override
Snapshot of the underlying data.
bool Drop(const StormByte::ByteSize &count) noexcept override
Discard bytes from the current read position.
void Clean() noexcept override
Discard already-consumed data up to the read position.
bool EoF() const noexcept override
End-of-stream condition.
void ReadUntilEoF(WriteOnly &out) const noexcept override
Read until EoF into a writer.
~Consumer() noexcept override
Destroy the Consumer.
void Clear() noexcept override
Clear stored bytes.
bool Read(const StormByte::ByteSize &count, StormByte::Safe::Binary &out) const noexcept override
Read into owned storage and advance the cursor.
bool HasError() const noexcept
Whether the shared Ring is in a permanent error state.
Definition consumer.hxx:204
StormByte::ByteSize Size() const noexcept override
Total number of bytes stored in the shared Ring.
void ExtractUntilEoF(WriteOnly &out) noexcept override
Extract until EoF into a writer.
void Seek(const std::ptrdiff_t &offset, const Position &mode) const noexcept override
Move the logical read position.
bool Extract(const StormByte::ByteSize &count, WriteOnly &out) noexcept override
Extract bytes into a writer.
bool Extract(const StormByte::ByteSize &count, StormByte::Safe::Binary &out) noexcept override
Extract bytes into owned storage.
void ReadUntilEoF(StormByte::Safe::Binary &out) const noexcept override
Read until EoF into owned storage.
void Close() noexcept
Close the shared Ring for further writes.
Definition consumer.hxx:244
friend class Producer
Definition consumer.hxx:366
StormByte::ByteSize Available() const noexcept override
Bytes available from the current position.
bool Empty() const noexcept override
Whether the shared Ring holds no stored bytes.
Consumer(Consumer &&other) noexcept
Take a Consumer.
void ExtractUntilEoF(StormByte::Safe::Binary &out) noexcept override
Extract until EoF into owned storage.
bool Read(const StormByte::ByteSize &count, WriteOnly &out) const noexcept override
Read into a writer and advance the cursor.
bool Peek(const StormByte::ByteSize &count, StormByte::Safe::Binary &out) const noexcept override
Peek into owned storage.
bool IsWritable() const noexcept
Whether the shared Ring still accepts writes.
Definition consumer.hxx:196
bool IsReadable() const noexcept override
Whether the shared Ring can still be read.
Consumer()
Create a Consumer and a new shared Ring.
bool Peek(const StormByte::ByteSize &count, WriteOnly &out) const noexcept override
Peek into a writer.
Consumer(const Consumer &other)
Copy a Consumer.
Write-only handle over a shared Ring.
Definition producer.hxx:71
ReadOnly() noexcept
Default constructor.
Highly concurrent thread-safe ring buffer.
Definition ring.hxx:90
Buffer that can be written and not read.
Definition generic.hxx:497
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
Buffer module of the StormByte suite.
Position
Forward declaration of the WriteOnly interface.
Definition typedefs.hxx:74
Root namespace of the StormByte C++ suite.
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:54