StormByte-Buffer 4.0.0
C++26 buffer module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Buffer::Ring Class Reference

Highly concurrent thread-safe ring buffer. More...

#include <StormByte/buffer/ring.hxx>

Inheritance diagram for StormByte::Buffer::Ring:
Collaboration diagram for StormByte::Buffer::Ring:

Public Member Functions

Constructors / destructor / assignment
 Ring () noexcept
 Construct an empty Ring.
 Ring (const StormByte::Safe::Binary &data) noexcept
 Copy initial data into deque storage.
 Ring (StormByte::Safe::Binary &&data) noexcept
 Move initial data into deque storage.
template<Type::ByteInputRange R>
requires (!Type::SameAs<R, StormByte::Safe::Binary>)
 Ring (const R &r) noexcept
 Convert an input range and delegate construction to the provider.
template<Type::ByteInputRange Rr>
 Ring (Rr &&r) noexcept
 Convert an rvalue range and delegate construction to the provider.
 Ring (std::string_view sv) noexcept
 Construct from a string view.
 Ring (const char *s) noexcept
 Construct from a C string.
 Ring (const Ring &)=delete
 Copy constructor.
 Ring (Ring &&other) noexcept
 Take a Ring.
virtual ~Ring () noexcept
 Destroy the Ring.
Ring & operator= (const Ring &)=delete
 Copy assignment.
Ring & operator= (Ring &&other) noexcept
 Move-assign a Ring.
Comparison
bool operator== (const Ring &other) const noexcept
 Compare contents and lifecycle state.
bool operator!= (const Ring &other) const noexcept
 Compare two Rings.
Queries
StormByte::ByteSize Available () const noexcept override
 Bytes available from the current read position.
const StormByte::Safe::Binary & Data () const noexcept override
 Snapshot of stored data.
bool Empty () const noexcept override
 Whether the underlying storage is empty.
bool EoF () const noexcept override
 End-of-stream condition.
bool HasError () const noexcept
 Whether SetError() has been called.
bool IsReadable () const noexcept override
 Whether the buffer can still be read.
bool IsWritable () const noexcept override
 Whether the buffer accepts writes.
StormByte::ByteSize Size () const noexcept override
 Total number of bytes stored.
Maintenance / lifecycle
void Clean () noexcept override
 Discard data from the start up to the current read position.
void Clear () noexcept override
 Clear stored bytes and reset the read position.
void Close () noexcept override
 Close the buffer for further writes and notify waiters.
bool Drop (const StormByte::ByteSize &count) noexcept override
 Discard unread bytes.
void Seek (const std::ptrdiff_t &offset, const Position &mode) const noexcept override
 Move the logical read position.
void SetError () noexcept override
 Enter the permanent error state and notify waiters.
Diagnostics
StormByte::Safe::String HexDump (const StormByte::ByteSize &columns=16, const StormByte::ByteSize &byte_limit=0) const noexcept
 Hexdump of unread contents from the current read position.
Peek (non-destructive, does not advance)
bool Peek (const StormByte::ByteSize &count, StormByte::Safe::Binary &outBuffer) const noexcept override
 Peek into owned storage without advancing the position.
bool Peek (const StormByte::ByteSize &count, WriteOnly &outBuffer) const noexcept override
 Peek into a writer without advancing the position.
Read (non-destructive, advances position)
bool Read (const StormByte::ByteSize &count, StormByte::Safe::Binary &outBuffer) const noexcept override
 Read into owned storage and advance the position.
bool Read (const StormByte::ByteSize &count, WriteOnly &outBuffer) const noexcept override
 Read into a writer and advance the position.
void ReadUntilEoF (StormByte::Safe::Binary &outBuffer) const noexcept override
 Read until EoF into owned storage.
void ReadUntilEoF (WriteOnly &outBuffer) const noexcept override
 Read until EoF into a writer.
Extract (destructive)
bool Extract (const StormByte::ByteSize &count, StormByte::Safe::Binary &outBuffer) noexcept override
 Extract bytes into owned storage.
bool Extract (const StormByte::ByteSize &count, WriteOnly &outBuffer) noexcept override
 Extract bytes into a writer.
void ExtractUntilEoF (StormByte::Safe::Binary &outBuffer) noexcept override
 Extract until EoF into owned storage.
void ExtractUntilEoF (WriteOnly &outBuffer) noexcept override
 Extract until EoF into a writer.
Write
bool Write (const StormByte::ByteSize &count, const StormByte::Safe::Binary &data) noexcept override
 Append bytes from owned storage (copy).
bool Write (const StormByte::ByteSize &count, StormByte::Safe::Binary &&data) noexcept override
 Append bytes from owned storage (move).
bool Write (const StormByte::ByteSize &count, const ReadOnly &data) noexcept override
 Append bytes from a readable buffer (copy).
bool Write (const StormByte::ByteSize &count, ReadOnly &&data) noexcept override
 Append bytes from a readable buffer (extract path).
bool Write (const ReadOnly &data) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
bool Write (ReadOnly &&data) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
bool Write (std::string_view sv) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
bool Write (const char *s) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
bool Write (const StormByte::ByteSize &count, std::string_view sv) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
bool Write (const StormByte::ByteSize &count, const char *s) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
template<std::size_t N>
bool Write (const char(&s)[N]) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
template<Type::ByteInputRange R>
STORMBYTE_FORCE_INLINE bool Write (const R &r) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
template<Type::ByteInputRange Rw>
STORMBYTE_FORCE_INLINE bool Write (const StormByte::ByteSize &count, const Rw &r) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
template<Type::ByteInputRange Rrw>
STORMBYTE_FORCE_INLINE bool Write (const StormByte::ByteSize &count, Rrw &&r) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
template<Type::ByteInputRange Rr>
STORMBYTE_FORCE_INLINE bool Write (Rr &&r) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
template<Type::ByteInputIterator I, typename S>
requires Type::SentinelFor<S, I>
STORMBYTE_FORCE_INLINE bool Write (I first, S last) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
template<Type::ByteInputIterator I2, typename S2>
requires Type::SentinelFor<S2, I2>
STORMBYTE_FORCE_INLINE bool Write (const StormByte::ByteSize &count, I2 first, S2 last) noexcept
 Bring the WriteOnly convenience Write overloads into scope.
Public Member Functions inherited from StormByte::Buffer::ReadWrite
 ReadWrite () noexcept
 Default constructor.
 ReadWrite (const ReadWrite &other) noexcept
 Copy constructor.
 ReadWrite (ReadWrite &&other) noexcept
 Move constructor.
virtual ~ReadWrite () noexcept
 Destructor.
ReadWrite & operator= (const ReadWrite &other) noexcept
 Copy assignment.
ReadWrite & operator= (ReadWrite &&other) noexcept
 Move assignment.
Public Member Functions inherited from StormByte::Buffer::ReadOnly
 ReadOnly () noexcept
 Default constructor.
 ReadOnly (const ReadOnly &other) noexcept
 Copy constructor.
 ReadOnly (ReadOnly &&other) noexcept
 Move constructor.
virtual ~ReadOnly () noexcept
 Destructor.
ReadOnly & operator= (const ReadOnly &other) noexcept
 Copy assignment.
ReadOnly & operator= (ReadOnly &&other) noexcept
 Move assignment.
bool Extract (StormByte::Safe::Binary &outBuffer) noexcept
 Extract all available bytes into a StormByte::Safe::Binary.
bool Extract (WriteOnly &outBuffer) noexcept
 Extract all available bytes into a WriteOnly.
bool Read (StormByte::Safe::Binary &outBuffer) const noexcept
 Read all available bytes into a StormByte::Safe::Binary.
bool Read (WriteOnly &outBuffer) const noexcept
 Read all available bytes into a WriteOnly.
Public Member Functions inherited from StormByte::Buffer::Generic
 Generic () noexcept
 Default constructor.
 Generic (const Generic &other) noexcept
 Copy constructor.
 Generic (Generic &&other) noexcept
 Move constructor.
virtual ~Generic () noexcept=0
 Pure virtual destructor.
Generic & operator= (const Generic &other) noexcept
 Copy assignment.
Generic & operator= (Generic &&other) noexcept
 Move assignment.
Public Member Functions inherited from StormByte::Buffer::WriteOnly
 WriteOnly () noexcept
 Default constructor.
 WriteOnly (const WriteOnly &other) noexcept
 Copy constructor.
 WriteOnly (WriteOnly &&other) noexcept
 Move constructor.
virtual ~WriteOnly () noexcept
 Destructor.
WriteOnly & operator= (const WriteOnly &other) noexcept
 Copy assignment.
WriteOnly & operator= (WriteOnly &&other) noexcept
 Move assignment.
bool Write (const ReadOnly &data) noexcept
 Append all available bytes from a ReadOnly (copy).
bool Write (ReadOnly &&data) noexcept
 Append all available bytes from a ReadOnly (extract).
bool Write (std::string_view sv) noexcept
 Write a string view.
bool Write (const char *s) noexcept
 Write a C string.
bool Write (const StormByte::ByteSize &count, std::string_view sv) noexcept
 Write up to count characters of a string view.
bool Write (const StormByte::ByteSize &count, const char *s) noexcept
 Write up to count characters of a C string.
template<std::size_t N>
bool Write (const char(&s)[N]) noexcept
 Write a string literal without the trailing NUL.
template<Type::ByteInputRange R>
STORMBYTE_FORCE_INLINE bool Write (const R &r) noexcept
 Write all elements from an input range.
template<Type::ByteInputRange Rw>
STORMBYTE_FORCE_INLINE bool Write (const StormByte::ByteSize &count, const Rw &r) noexcept
 Write up to count elements from an input range.
template<Type::ByteInputRange Rrw>
STORMBYTE_FORCE_INLINE bool Write (const StormByte::ByteSize &count, Rrw &&r) noexcept
 Write up to count elements from an rvalue range.
template<Type::ByteInputRange Rr>
STORMBYTE_FORCE_INLINE bool Write (Rr &&r) noexcept
 Write all elements from an rvalue range.
template<Type::ByteInputIterator I, typename S>
requires Type::SentinelFor<S, I>
STORMBYTE_FORCE_INLINE bool Write (I first, S last) noexcept
 Write all elements from an iterator pair.
template<Type::ByteInputIterator I2, typename S2>
requires Type::SentinelFor<S2, I2>
STORMBYTE_FORCE_INLINE bool Write (const StormByte::ByteSize &count, I2 first, S2 last) noexcept
 Write up to count elements from an iterator pair.

Protected Types

enum class  Operation { Extract , Read , Peek }
 Kind of internal read operation. More...

Protected Member Functions

virtual StormByte::Safe::String HexDumpHeader () const noexcept
 Build the hexdump header.
Internal helpers
virtual bool ReadInternal (const StormByte::ByteSize &count, StormByte::Safe::Binary &outBuffer, Operation flag) noexcept
 Shared Extract, Read and Peek into owned storage.
virtual bool ReadInternal (const StormByte::ByteSize &count, WriteOnly &outBuffer, Operation flag) noexcept
 Shared Extract, Read and Peek into a writer.
virtual void ReadUntilEoFInternal (StormByte::Safe::Binary &outBuffer, Operation flag) noexcept
 Drain until EoF into owned storage.
virtual void ReadUntilEoFInternal (WriteOnly &outBuffer, Operation flag) noexcept
 Drain until EoF into a writer.
virtual bool WriteInternal (const StormByte::ByteSize &count, const StormByte::Safe::Binary &src) noexcept
 Append from owned storage (copy).
virtual bool WriteInternal (const StormByte::ByteSize &count, StormByte::Safe::Binary &&src) noexcept
 Append from owned storage (move).

Static Protected Member Functions

static StormByte::Safe::String FormatHexLines (std::span< const std::byte > data, StormByte::ByteSize start_offset, StormByte::ByteSize columns) noexcept
 Format hex/ASCII lines for a data span.
Static Protected Member Functions inherited from StormByte::Buffer::Generic
template<Type::ByteInputRange Src>
static STORMBYTE_FORCE_INLINE Safe::Binary DataConvert (const Src &src) noexcept
 Convert an lvalue input range to StormByte::Safe::Binary.
template<Type::ByteInputRange Src>
static STORMBYTE_FORCE_INLINE Safe::Binary DataConvert (Src &&src) noexcept
 Convert an rvalue input range to StormByte::Safe::Binary.
static Safe::Binary DataConvert (std::string_view sv) noexcept
 Convert a string view to StormByte::Safe::Binary.
static Safe::Binary DataConvert (const char *s) noexcept
 Convert a C string to StormByte::Safe::Binary.

Detailed Description

Highly concurrent thread-safe ring buffer.

Backed by StormByte::Safe::Deque of std::byte with a logical read position. Uses StormByte::Safe::SharedMutex so several readers can proceed while writers and destructive operations stay exclusive. Blocked readers wait on a StormByte::Safe::ConditionVariableAny.

Fully thread-safe for concurrent producers and consumers. Pipeline intermediates use a private SPSC ring; this type is the public many-to-many ring.

Close() stops further writes; remaining data can still be drained. SetError() makes the buffer permanently unreadable and unwritable and wakes waiters.

Construction from bytes, a range, a string view or a C string is explicit.

See also
Producer, Consumer, ReadWrite, SharedFIFO

Member Enumeration Documentation

◆ Operation

enum class StormByte::Buffer::Ring::Operation
strongprotected

Kind of internal read operation.

Enumerator
Extract 

Destructive read.

Read 

Non-destructive read. Advances the position.

Peek 

Non-destructive peek. Does not advance.

Constructor & Destructor Documentation

◆ Ring() [1/9]

StormByte::Buffer::Ring::Ring ( )
noexcept

Construct an empty Ring.

Synchronization is built in the provider module.

◆ Ring() [2/9]

StormByte::Buffer::Ring::Ring ( const StormByte::Safe::Binary & data)
explicitnoexcept

Copy initial data into deque storage.

Parameters
dataSource bytes.

◆ Ring() [3/9]

StormByte::Buffer::Ring::Ring ( StormByte::Safe::Binary && data)
explicitnoexcept

Move initial data into deque storage.

Parameters
dataSource bytes. Moved element-wise into the deque.

◆ Ring() [4/9]

template<Type::ByteInputRange R>
requires (!Type::SameAs<R, StormByte::Safe::Binary>)
StormByte::Buffer::Ring::Ring ( const R & r)
inlineexplicitnoexcept

Convert an input range and delegate construction to the provider.

Template Parameters
RRange whose value converts to std::byte.
Parameters
rSource range. Disabled when it is already StormByte::Safe::Binary.

◆ Ring() [5/9]

template<Type::ByteInputRange Rr>
StormByte::Buffer::Ring::Ring ( Rr && r)
inlineexplicitnoexcept

Convert an rvalue range and delegate construction to the provider.

Template Parameters
RrRange type.
Parameters
rSource range.

◆ Ring() [6/9]

StormByte::Buffer::Ring::Ring ( std::string_view sv)
explicitnoexcept

Construct from a string view.

No trailing NUL.

Parameters
svSource characters.

◆ Ring() [7/9]

StormByte::Buffer::Ring::Ring ( const char * s)
inlineexplicitnoexcept

Construct from a C string.

Parameters
sSource. Null yields an empty buffer.

◆ Ring() [8/9]

StormByte::Buffer::Ring::Ring ( const Ring & )
delete

Copy constructor.

Deleted: the mutex is not copyable.

◆ Ring() [9/9]

StormByte::Buffer::Ring::Ring ( Ring && other)
noexcept

Take a Ring.

Parameters
otherSource.

◆ ~Ring()

virtual StormByte::Buffer::Ring::~Ring ( )
virtualnoexcept

Destroy the Ring.

Member Function Documentation

◆ Available()

StormByte::ByteSize StormByte::Buffer::Ring::Available ( ) const
overridevirtualnoexcept

Bytes available from the current read position.

Returns
Unread byte count.

Implements StormByte::Buffer::ReadOnly.

◆ Clean()

void StormByte::Buffer::Ring::Clean ( )
overridevirtualnoexcept

Discard data from the start up to the current read position.

Implements StormByte::Buffer::ReadOnly.

◆ Clear()

void StormByte::Buffer::Ring::Clear ( )
overridevirtualnoexcept

Clear stored bytes and reset the read position.

Does not clear closed or error flags.

Implements StormByte::Buffer::ReadOnly.

◆ Close()

void StormByte::Buffer::Ring::Close ( )
overridevirtualnoexcept

Close the buffer for further writes and notify waiters.

Later writes fail. Readers may still drain.

Implements StormByte::Buffer::WriteOnly.

◆ Data()

const StormByte::Safe::Binary & StormByte::Buffer::Ring::Data ( ) const
overridevirtualnoexcept

Snapshot of stored data.

May rebuild an internal cache.

Returns
Owned snapshot.

Implements StormByte::Buffer::ReadOnly.

◆ Drop()

bool StormByte::Buffer::Ring::Drop ( const StormByte::ByteSize & count)
overridevirtualnoexcept

Discard unread bytes.

Parameters
countBytes to drop.
Returns
False if fewer bytes were available.

Implements StormByte::Buffer::ReadOnly.

◆ Empty()

bool StormByte::Buffer::Ring::Empty ( ) const
overridevirtualnoexcept

Whether the underlying storage is empty.

Returns
Whether storage is empty.

Implements StormByte::Buffer::ReadOnly.

◆ EoF()

bool StormByte::Buffer::Ring::EoF ( ) const
overridevirtualnoexcept

End-of-stream condition.

Returns
Whether the ring is closed or in error and nothing unread remains.

Implements StormByte::Buffer::ReadOnly.

◆ Extract() [1/2]

bool StormByte::Buffer::Ring::Extract ( const StormByte::ByteSize & count,
StormByte::Safe::Binary & outBuffer )
overridevirtualnoexcept

Extract bytes into owned storage.

Parameters
countBytes to extract. 0 means all available.
outBufferDestination.
Returns
False on failure.

Implements StormByte::Buffer::ReadOnly.

◆ Extract() [2/2]

bool StormByte::Buffer::Ring::Extract ( const StormByte::ByteSize & count,
WriteOnly & outBuffer )
overridevirtualnoexcept

Extract bytes into a writer.

Parameters
countBytes to extract. 0 means all available.
outBufferDestination writer.
Returns
False on failure.

Implements StormByte::Buffer::ReadOnly.

◆ ExtractUntilEoF() [1/2]

void StormByte::Buffer::Ring::ExtractUntilEoF ( StormByte::Safe::Binary & outBuffer)
overridevirtualnoexcept

Extract until EoF into owned storage.

Parameters
outBufferDestination.

Implements StormByte::Buffer::ReadOnly.

◆ ExtractUntilEoF() [2/2]

void StormByte::Buffer::Ring::ExtractUntilEoF ( WriteOnly & outBuffer)
overridevirtualnoexcept

Extract until EoF into a writer.

Parameters
outBufferDestination writer.

Implements StormByte::Buffer::ReadOnly.

◆ FormatHexLines()

StormByte::Safe::String StormByte::Buffer::Ring::FormatHexLines ( std::span< const std::byte > data,
StormByte::ByteSize start_offset,
StormByte::ByteSize columns )
staticprotectednoexcept

Format hex/ASCII lines for a data span.

Parameters
dataBytes to dump.
start_offsetDisplay offset of the first byte.
columnsBytes per line.
Returns
Formatted lines, without a header.

◆ HasError()

bool StormByte::Buffer::Ring::HasError ( ) const
noexcept

Whether SetError() has been called.

Returns
Whether the buffer is in a permanent error state.

◆ HexDump()

StormByte::Safe::String StormByte::Buffer::Ring::HexDump ( const StormByte::ByteSize & columns = 16,
const StormByte::ByteSize & byte_limit = 0 ) const
noexcept

Hexdump of unread contents from the current read position.

Parameters
columnsBytes per line. 0 means 16.
byte_limitMaximum bytes to include. 0 means no limit.
Returns
Formatted diagnostic text.

◆ HexDumpHeader()

virtual StormByte::Safe::String StormByte::Buffer::Ring::HexDumpHeader ( ) const
protectedvirtualnoexcept

Build the hexdump header.

Returns
Owned header text. Any formatting stream stays in this module.

◆ IsReadable()

bool StormByte::Buffer::Ring::IsReadable ( ) const
overridevirtualnoexcept

Whether the buffer can still be read.

Returns
False in a permanent error state.

Implements StormByte::Buffer::ReadOnly.

◆ IsWritable()

bool StormByte::Buffer::Ring::IsWritable ( ) const
overridevirtualnoexcept

Whether the buffer accepts writes.

Returns
False if closed or in error.

Implements StormByte::Buffer::WriteOnly.

◆ operator!=()

bool StormByte::Buffer::Ring::operator!= ( const Ring & other) const
inlinenoexcept

Compare two Rings.

Parameters
otherOther Ring.
Returns
Whether the rings differ.

◆ operator=() [1/2]

Ring & StormByte::Buffer::Ring::operator= ( const Ring & )
delete

Copy assignment.

Deleted.

◆ operator=() [2/2]

Ring & StormByte::Buffer::Ring::operator= ( Ring && other)
noexcept

Move-assign a Ring.

Parameters
otherSource.
Returns
This Ring.

◆ operator==()

bool StormByte::Buffer::Ring::operator== ( const Ring & other) const
noexcept

Compare contents and lifecycle state.

Parameters
otherOther Ring.
Returns
Whether the rings match.

◆ Peek() [1/2]

bool StormByte::Buffer::Ring::Peek ( const StormByte::ByteSize & count,
StormByte::Safe::Binary & outBuffer ) const
overridevirtualnoexcept

Peek into owned storage without advancing the position.

Parameters
countBytes to peek. 0 means all available.
outBufferDestination.
Returns
False on failure.

Implements StormByte::Buffer::ReadOnly.

◆ Peek() [2/2]

bool StormByte::Buffer::Ring::Peek ( const StormByte::ByteSize & count,
WriteOnly & outBuffer ) const
overridevirtualnoexcept

Peek into a writer without advancing the position.

Parameters
countBytes to peek. 0 means all available.
outBufferDestination writer.
Returns
False on failure.

Implements StormByte::Buffer::ReadOnly.

◆ Read() [1/2]

bool StormByte::Buffer::Ring::Read ( const StormByte::ByteSize & count,
StormByte::Safe::Binary & outBuffer ) const
overridevirtualnoexcept

Read into owned storage and advance the position.

Parameters
countBytes to read. 0 means all available.
outBufferDestination.
Returns
False on failure.

Implements StormByte::Buffer::ReadOnly.

◆ Read() [2/2]

bool StormByte::Buffer::Ring::Read ( const StormByte::ByteSize & count,
WriteOnly & outBuffer ) const
overridevirtualnoexcept

Read into a writer and advance the position.

Parameters
countBytes to read. 0 means all available.
outBufferDestination writer.
Returns
False on failure.

Implements StormByte::Buffer::ReadOnly.

◆ ReadInternal() [1/2]

virtual bool StormByte::Buffer::Ring::ReadInternal ( const StormByte::ByteSize & count,
StormByte::Safe::Binary & outBuffer,
Operation flag )
protectedvirtualnoexcept

Shared Extract, Read and Peek into owned storage.

Parameters
countRequested byte count. 0 means all available.
outBufferDestination.
flagOperation kind.
Returns
False on failure.

◆ ReadInternal() [2/2]

virtual bool StormByte::Buffer::Ring::ReadInternal ( const StormByte::ByteSize & count,
WriteOnly & outBuffer,
Operation flag )
protectedvirtualnoexcept

Shared Extract, Read and Peek into a writer.

Parameters
countRequested byte count. 0 means all available.
outBufferDestination writer.
flagOperation kind.
Returns
False on failure.

◆ ReadUntilEoF() [1/2]

void StormByte::Buffer::Ring::ReadUntilEoF ( StormByte::Safe::Binary & outBuffer) const
overridevirtualnoexcept

Read until EoF into owned storage.

Parameters
outBufferDestination.

Implements StormByte::Buffer::ReadOnly.

◆ ReadUntilEoF() [2/2]

void StormByte::Buffer::Ring::ReadUntilEoF ( WriteOnly & outBuffer) const
overridevirtualnoexcept

Read until EoF into a writer.

Parameters
outBufferDestination writer.

Implements StormByte::Buffer::ReadOnly.

◆ ReadUntilEoFInternal() [1/2]

virtual void StormByte::Buffer::Ring::ReadUntilEoFInternal ( StormByte::Safe::Binary & outBuffer,
Operation flag )
protectedvirtualnoexcept

Drain until EoF into owned storage.

Parameters
outBufferDestination.
flagExtract or Read.

◆ ReadUntilEoFInternal() [2/2]

virtual void StormByte::Buffer::Ring::ReadUntilEoFInternal ( WriteOnly & outBuffer,
Operation flag )
protectedvirtualnoexcept

Drain until EoF into a writer.

Parameters
outBufferDestination.
flagExtract or Read.

◆ Seek()

void StormByte::Buffer::Ring::Seek ( const std::ptrdiff_t & offset,
const Position & mode ) const
overridevirtualnoexcept

Move the logical read position.

Parameters
offsetOffset.
modeAbsolute or relative.

Implements StormByte::Buffer::ReadOnly.

◆ SetError()

void StormByte::Buffer::Ring::SetError ( )
overridevirtualnoexcept

Enter the permanent error state and notify waiters.

Implements StormByte::Buffer::WriteOnly.

◆ Size()

StormByte::ByteSize StormByte::Buffer::Ring::Size ( ) const
overridevirtualnoexcept

Total number of bytes stored.

Returns
Size in bytes.

Implements StormByte::Buffer::Generic.

◆ Write() [1/17]

bool StormByte::Buffer::WriteOnly::Write ( const char * s)
noexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [2/17]

template<std::size_t N>
bool StormByte::Buffer::WriteOnly::Write ( const char(&) s[N])
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [3/17]

template<Type::ByteInputRange R>
STORMBYTE_FORCE_INLINE bool StormByte::Buffer::WriteOnly::Write ( const R & r)
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [4/17]

bool StormByte::Buffer::WriteOnly::Write ( const ReadOnly & data)
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [5/17]

bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize & count,
const char * s )
noexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [6/17]

bool StormByte::Buffer::Ring::Write ( const StormByte::ByteSize & count,
const ReadOnly & data )
overridevirtualnoexcept

Append bytes from a readable buffer (copy).

Parameters
countBytes to write.
dataSource buffer.
Returns
False if closed or in error.

Implements StormByte::Buffer::WriteOnly.

◆ Write() [7/17]

template<Type::ByteInputRange Rw>
STORMBYTE_FORCE_INLINE bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize & count,
const Rw & r )
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [8/17]

bool StormByte::Buffer::Ring::Write ( const StormByte::ByteSize & count,
const StormByte::Safe::Binary & data )
overridevirtualnoexcept

Append bytes from owned storage (copy).

Parameters
countBytes to write.
dataSource.
Returns
False if closed or in error.

Implements StormByte::Buffer::WriteOnly.

◆ Write() [9/17]

template<Type::ByteInputIterator I2, typename S2>
requires Type::SentinelFor<S2, I2>
STORMBYTE_FORCE_INLINE bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize & count,
I2 first,
S2 last )
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [10/17]

bool StormByte::Buffer::Ring::Write ( const StormByte::ByteSize & count,
ReadOnly && data )
overridevirtualnoexcept

Append bytes from a readable buffer (extract path).

Parameters
countBytes to write.
dataSource buffer.
Returns
False if closed or in error.

Implements StormByte::Buffer::WriteOnly.

◆ Write() [11/17]

template<Type::ByteInputRange Rrw>
STORMBYTE_FORCE_INLINE bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize & count,
Rrw && r )
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [12/17]

bool StormByte::Buffer::WriteOnly::Write ( const StormByte::ByteSize & count,
std::string_view sv )
noexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [13/17]

bool StormByte::Buffer::Ring::Write ( const StormByte::ByteSize & count,
StormByte::Safe::Binary && data )
overridevirtualnoexcept

Append bytes from owned storage (move).

Parameters
countBytes to write.
dataSource.
Returns
False if closed or in error.

Implements StormByte::Buffer::WriteOnly.

◆ Write() [14/17]

template<Type::ByteInputIterator I, typename S>
requires Type::SentinelFor<S, I>
STORMBYTE_FORCE_INLINE bool StormByte::Buffer::WriteOnly::Write ( I first,
S last )
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [15/17]

bool StormByte::Buffer::WriteOnly::Write ( ReadOnly && data)
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [16/17]

template<Type::ByteInputRange Rr>
STORMBYTE_FORCE_INLINE bool StormByte::Buffer::WriteOnly::Write ( Rr && r)
inlinenoexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ Write() [17/17]

bool StormByte::Buffer::WriteOnly::Write ( std::string_view sv)
noexcept

Bring the WriteOnly convenience Write overloads into scope.

◆ WriteInternal() [1/2]

virtual bool StormByte::Buffer::Ring::WriteInternal ( const StormByte::ByteSize & count,
const StormByte::Safe::Binary & src )
protectedvirtualnoexcept

Append from owned storage (copy).

Parameters
countBytes to write.
srcSource.
Returns
False if closed or in error.

◆ WriteInternal() [2/2]

virtual bool StormByte::Buffer::Ring::WriteInternal ( const StormByte::ByteSize & count,
StormByte::Safe::Binary && src )
protectedvirtualnoexcept

Append from owned storage (move).

Parameters
countBytes to write.
srcSource.
Returns
False if closed or in error.

The documentation for this class was generated from the following file: