StormByte C++ Library: Buffer module 1.2.0
StormByte-Buffer is the buffer module of the StormByte C++ suite.
Loading...
Searching...
No Matches
Protected Types | Protected Member Functions | Static Protected Member Functions | List of all members
StormByte::Buffer::Ring Class Reference

High-performance, highly-concurrent thread-safe ring buffer. More...

#include <StormByte/buffer/ring.hxx>

Inheritance diagram for StormByte::Buffer::Ring:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Buffer::Ring:
Collaboration graph
[legend]

Public Member Functions

Constructors / destructor / assignment
 Ring () noexcept=default
 Default construct an empty Ring.
 
 Ring (const DataType &data) noexcept
 Construct with initial data (copy).
 
 Ring (DataType &&data) noexcept
 Construct with initial data (move elements from vector).
 
template<Type::ByteInputRange R>
requires (!Type::SameAs<R, DataType>)
 Ring (const R &r) noexcept
 Construct from an input range (copy / convert).
 
template<Type::ByteInputRange Rr>
 Ring (Rr &&r) noexcept
 Construct from an rvalue range.
 
 Ring (std::string_view sv) noexcept
 Construct from a string view (no trailing NUL).
 
 Ring (const char *s) noexcept
 Construct from a null-terminated C string.
 
 Ring (const Ring &)=delete
 Copy constructor (deleted – mutexes are not copyable).
 
 Ring (Ring &&other) noexcept
 Move constructor.
 
virtual ~Ring () noexcept
 Virtual destructor.
 
Ringoperator= (const Ring &)=delete
 Copy assignment (deleted).
 
Ringoperator= (Ring &&other) noexcept
 Move assignment.
 
Comparison
bool operator== (const Ring &other) const noexcept
 Equality comparison (contents and lifecycle state).
 
bool operator!= (const Ring &other) const noexcept
 Inequality comparison.
 
Queries
std::size_t AvailableBytes () const noexcept override
 Bytes available from the current read position.
 
const DataTypeData () const noexcept override
 Snapshot of stored data (may rebuild an internal cache).
 
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.
 
std::size_t 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 all contents and reset the read position.
 
void Close () noexcept override
 Close the buffer for further writes.
 
bool Drop (const std::size_t &count) noexcept override
 Discard count unread bytes.
 
void Seek (const std::ptrdiff_t &offset, const Position &mode) const noexcept override
 Move the logical read position for non-destructive reads.
 
void SetError () noexcept override
 Enter permanent error state (unreadable and unwritable).
 
Diagnostics
std::string HexDump (const std::size_t &columns=16, const std::size_t &byte_limit=0) const noexcept
 Hexdump of unread contents from the current read position.
 
Peek (non-destructive, does not advance)
bool Peek (const std::size_t &count, DataType &outBuffer) const noexcept override
 Peek into a DataType without advancing the read position.
 
bool Peek (const std::size_t &count, WriteOnly &outBuffer) const noexcept override
 Peek into a WriteOnly without advancing the read position.
 
Read (non-destructive, advances position)
bool Read (const std::size_t &count, DataType &outBuffer) const noexcept override
 Read into a DataType.
 
bool Read (const std::size_t &count, WriteOnly &outBuffer) const noexcept override
 Read into a WriteOnly.
 
void ReadUntilEoF (DataType &outBuffer) const noexcept override
 Read until EoF into a DataType.
 
void ReadUntilEoF (WriteOnly &outBuffer) const noexcept override
 Read until EoF into a WriteOnly.
 
Extract (destructive)
bool Extract (const std::size_t &count, DataType &outBuffer) noexcept override
 Extract bytes into a DataType.
 
bool Extract (const std::size_t &count, WriteOnly &outBuffer) noexcept override
 Extract bytes into a WriteOnly.
 
void ExtractUntilEoF (DataType &outBuffer) noexcept override
 Extract until EoF into a DataType.
 
void ExtractUntilEoF (WriteOnly &outBuffer) noexcept override
 Extract until EoF into a WriteOnly.
 
Write
bool Write (const std::size_t &count, const DataType &data) noexcept override
 Append bytes from a DataType (copy).
 
bool Write (const std::size_t &count, DataType &&data) noexcept override
 Append bytes from a DataType (move).
 
bool Write (const std::size_t &count, const ReadOnly &data) noexcept override
 Append bytes from a ReadOnly (copy path).
 
bool Write (const std::size_t &count, ReadOnly &&data) noexcept override
 Append bytes from a ReadOnly (move / extract path).
 
virtual bool Write (const std::size_t &count, const DataType &data) noexcept=0
 Bring WriteOnly convenience Write overloads into scope.
 
virtual bool Write (const std::size_t &count, DataType &&data) noexcept=0
 Bring WriteOnly convenience Write overloads into scope.
 
virtual bool Write (const std::size_t &count, const ReadOnly &data) noexcept=0
 Bring WriteOnly convenience Write overloads into scope.
 
virtual bool Write (const std::size_t &count, ReadOnly &&data) noexcept=0
 Bring WriteOnly convenience Write overloads into scope.
 
bool Write (const ReadOnly &data) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
bool Write (ReadOnly &&data) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
bool Write (std::string_view sv) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
bool Write (const char *s) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
bool Write (const std::size_t &count, std::string_view sv) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
bool Write (const std::size_t &count, const char *s) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
template<std::size_t N>
bool Write (const char(&s)[N]) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
template<Type::ByteInputRange R>
bool Write (const R &r) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
template<Type::ByteInputRange Rw>
bool Write (const std::size_t &count, const Rw &r) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
template<Type::ByteInputRange Rrw>
bool Write (const std::size_t &count, Rrw &&r) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
template<Type::ByteInputRange Rr>
bool Write (Rr &&r) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
template<Type::ByteInputIterator I, typename S >
requires Type::SentinelFor<S, I>
bool Write (I first, S last) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
template<Type::ByteInputIterator I2, typename S2 >
requires Type::SentinelFor<S2, I2>
bool Write (const std::size_t &count, I2 first, S2 last) noexcept
 Bring WriteOnly convenience Write overloads into scope.
 
- Public Member Functions inherited from StormByte::Buffer::ReadWrite
 ReadWrite () noexcept
 Default construct.
 
 ReadWrite (const ReadWrite &other) noexcept=default
 Copy construct.
 
 ReadWrite (ReadWrite &&other) noexcept=default
 Move construct.
 
virtual ~ReadWrite () noexcept
 Virtual destructor.
 
ReadWriteoperator= (const ReadWrite &other)=default
 Copy assign.
 
ReadWriteoperator= (ReadWrite &&other) noexcept=default
 Move assign.
 
- Public Member Functions inherited from StormByte::Buffer::ReadOnly
 ReadOnly () noexcept
 Default construct.
 
 ReadOnly (const ReadOnly &) noexcept=default
 Copy construct.
 
 ReadOnly (ReadOnly &&) noexcept=default
 Move construct.
 
virtual ~ReadOnly () noexcept
 Virtual destructor.
 
ReadOnlyoperator= (const ReadOnly &)=default
 Copy assign.
 
ReadOnlyoperator= (ReadOnly &&) noexcept=default
 Move assign.
 
bool Extract (DataType &outBuffer) noexcept
 Extract all available bytes into a DataType.
 
bool Extract (WriteOnly &outBuffer) noexcept
 Extract all available bytes into a WriteOnly.
 
bool Read (DataType &outBuffer) const noexcept
 Read all available bytes into a DataType.
 
bool Read (WriteOnly &outBuffer) const noexcept
 Read all available bytes into a WriteOnly.
 
- Public Member Functions inherited from StormByte::Buffer::Generic
 Generic () noexcept=default
 Default construct.
 
 Generic (const Generic &) noexcept=default
 Copy construct.
 
 Generic (Generic &&) noexcept=default
 Move construct.
 
virtual ~Generic () noexcept=0
 Pure virtual destructor (keeps the class abstract).
 
Genericoperator= (const Generic &other)=default
 Copy assign.
 
Genericoperator= (Generic &&) noexcept=default
 Move assign.
 
- Public Member Functions inherited from StormByte::Buffer::WriteOnly
 WriteOnly () noexcept
 Default construct.
 
 WriteOnly (const WriteOnly &)=default
 Copy construct.
 
 WriteOnly (WriteOnly &&) noexcept=default
 Move construct.
 
virtual ~WriteOnly () noexcept
 Virtual destructor.
 
WriteOnlyoperator= (const WriteOnly &)=default
 Copy assign.
 
WriteOnlyoperator= (WriteOnly &&) noexcept=default
 Move assign.
 
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 (move path).
 
bool Write (std::string_view sv) noexcept
 Write a string view (no trailing NUL).
 
bool Write (const char *s) noexcept
 Write a null-terminated C string.
 
bool Write (const std::size_t &count, std::string_view sv) noexcept
 Write up to count characters from a string view.
 
bool Write (const std::size_t &count, const char *s) noexcept
 Write up to count characters from 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>
bool Write (const R &r) noexcept
 Write all elements from an input range.
 
template<Type::ByteInputRange Rw>
bool Write (const std::size_t &count, const Rw &r) noexcept
 Write up to count elements from an input range.
 
template<Type::ByteInputRange Rrw>
bool Write (const std::size_t &count, Rrw &&r) noexcept
 Write up to count elements from an rvalue range.
 
template<Type::ByteInputRange Rr>
bool Write (Rr &&r) noexcept
 Write all elements from an rvalue range.
 
template<Type::ByteInputIterator I, typename S >
requires Type::SentinelFor<S, I>
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>
bool Write (const std::size_t &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 std::ostringstream HexDumpHeader () const noexcept
 Build the hexdump header (size / position / status).
 
Internal helpers
virtual bool ReadInternal (const std::size_t &count, DataType &outBuffer, Operation flag) noexcept
 
virtual bool ReadInternal (const std::size_t &count, WriteOnly &outBuffer, Operation flag) noexcept
 
virtual void ReadUntilEoFInternal (DataType &outBuffer, Operation flag) noexcept
 
virtual void ReadUntilEoFInternal (WriteOnly &outBuffer, Operation flag) noexcept
 
virtual bool WriteInternal (const std::size_t &count, const DataType &src) noexcept
 
virtual bool WriteInternal (const std::size_t &count, DataType &&src) noexcept
 

Static Protected Member Functions

static std::string FormatHexLines (std::span< const std::byte > data, std::size_t start_offset, std::size_t columns) noexcept
 Format hex/ASCII lines for a data span.
 
- Static Protected Member Functions inherited from StormByte::Buffer::Generic
template<Type::ByteInputRange Src>
static DataType DataConvert (const Src &src) noexcept
 Convert an lvalue input range to DataType.
 
template<Type::ByteInputRange Src>
static DataType DataConvert (Src &&src) noexcept
 Convert an rvalue input range to DataType (moves when already DataType).
 
static DataType DataConvert (std::string_view sv) noexcept
 Convert a string view to DataType (no trailing NUL).
 
static DataType DataConvert (const char *s) noexcept
 Convert a null-terminated C string to DataType.
 

Detailed Description

High-performance, highly-concurrent thread-safe ring buffer.

Overview
Backed by std::deque<std::byte> with a logical read position. Uses std::shared_mutex so multiple readers can proceed concurrently while writers and destructive operations remain exclusive. Critical sections are kept as short as possible; blocked readers wait on a condition_variable_any.
Thread safety
Fully thread-safe for concurrent producers and consumers (many-to-many). Prefer LockFreeRing inside Pipeline intermediates for SPSC lock-free performance when applicable.
Lifecycle
Close() stops further writes; remaining data can still be drained. SetError() makes the buffer permanently unreadable and unwritable and wakes waiters.
See also
Producer, Consumer, LockFreeRing, 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 position)

Peek 

Non-destructive peek (no advance)

Constructor & Destructor Documentation

◆ Ring() [1/9]

StormByte::Buffer::Ring::Ring ( )
defaultnoexcept

Default construct an empty Ring.

◆ Ring() [2/9]

StormByte::Buffer::Ring::Ring ( const DataType data)
inlineexplicitnoexcept

Construct with initial data (copy).

Parameters
dataSource bytes.

◆ Ring() [3/9]

StormByte::Buffer::Ring::Ring ( DataType &&  data)
inlineexplicitnoexcept

Construct with initial data (move elements from vector).

Parameters
dataSource bytes (moved element-wise into the deque).

◆ Ring() [4/9]

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

Construct from an input range (copy / convert).

Template Parameters
RRange whose value_type is convertible to std::byte.
Parameters
rSource range (disabled when already DataType).

◆ Ring() [5/9]

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

Construct from an rvalue range.

Template Parameters
RrRange type.
Parameters
rSource range.

◆ Ring() [6/9]

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

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 null-terminated C string.

Parameters
sSource string (may be null → empty).

◆ Ring() [8/9]

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

Copy constructor (deleted – mutexes are not copyable).

◆ Ring() [9/9]

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

Move constructor.

Parameters
otherSource Ring.

◆ ~Ring()

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

Virtual destructor.

Member Function Documentation

◆ AvailableBytes()

std::size_t StormByte::Buffer::Ring::AvailableBytes ( ) 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 all contents and reset the read position.

Does not clear closed / error flags.

Implements StormByte::Buffer::ReadOnly.

◆ Close()

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

Close the buffer for further writes.

Subsequent writes fail; readers may still drain data. Waiters are notified.

Implements StormByte::Buffer::WriteOnly.

◆ Data()

const DataType & StormByte::Buffer::Ring::Data ( ) const
overridevirtualnoexcept

Snapshot of stored data (may rebuild an internal cache).

Returns
Constant reference to a DataType view.

Implements StormByte::Buffer::ReadOnly.

◆ Drop()

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

Discard count unread bytes.

Parameters
countNumber of bytes to drop.
Returns
true on success, 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
true if empty.

Implements StormByte::Buffer::ReadOnly.

◆ EoF()

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

End-of-stream condition.

Returns
true if closed (or in error) and no unread bytes remain.

Implements StormByte::Buffer::ReadOnly.

◆ Extract() [1/2]

bool StormByte::Buffer::Ring::Extract ( const std::size_t &  count,
DataType outBuffer 
)
overridevirtualnoexcept

Extract bytes into a DataType.

Parameters
countBytes to extract; 0 = all available.
outBufferDestination.
Returns
true on success, false on failure.

Implements StormByte::Buffer::ReadOnly.

◆ Extract() [2/2]

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

Extract bytes into a WriteOnly.

Parameters
countBytes to extract; 0 = all available.
outBufferDestination writer.
Returns
true on success, false on failure.

Implements StormByte::Buffer::ReadOnly.

◆ ExtractUntilEoF() [1/2]

void StormByte::Buffer::Ring::ExtractUntilEoF ( DataType outBuffer)
overridevirtualnoexcept

Extract until EoF into a DataType.

Parameters
outBufferDestination.

Implements StormByte::Buffer::ReadOnly.

◆ ExtractUntilEoF() [2/2]

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

Extract until EoF into a WriteOnly.

Parameters
outBufferDestination writer.

Implements StormByte::Buffer::ReadOnly.

◆ FormatHexLines()

static std::string StormByte::Buffer::Ring::FormatHexLines ( std::span< const std::byte >  data,
std::size_t  start_offset,
std::size_t  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 (no header).

◆ HasError()

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

Whether SetError() has been called.

Returns
true in permanent error state.

◆ HexDump()

std::string StormByte::Buffer::Ring::HexDump ( const std::size_t &  columns = 16,
const std::size_t &  byte_limit = 0 
) const
noexcept

Hexdump of unread contents from the current read position.

Parameters
columnsBytes per line (0 → default 16).
byte_limitMax bytes to include (0 → no limit).
Returns
Formatted diagnostic string.

◆ HexDumpHeader()

virtual std::ostringstream StormByte::Buffer::Ring::HexDumpHeader ( ) const
protectedvirtualnoexcept

Build the hexdump header (size / position / status).

Returns
Stream containing the header lines.

◆ IsReadable()

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

Whether the buffer can still be read.

Returns
false in 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

Inequality comparison.

Parameters
otherOther Ring.
Returns
Negation of operator==.

◆ 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 assignment.

Parameters
otherSource Ring.
Returns
Reference to this Ring.

◆ operator==()

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

Equality comparison (contents and lifecycle state).

Parameters
otherOther Ring.
Returns
true if equal under the comparison rules.

◆ Peek() [1/2]

bool StormByte::Buffer::Ring::Peek ( const std::size_t &  count,
DataType outBuffer 
) const
overridevirtualnoexcept

Peek into a DataType without advancing the read position.

Parameters
countBytes to peek; 0 = all available.
outBufferDestination.
Returns
true on success, false if insufficient data or error.
  • count == 0: all available bytes (fails if none).
  • count > 0: exactly count bytes, or fail if fewer are available.
See also
Read(), Seek()

Implements StormByte::Buffer::ReadOnly.

◆ Peek() [2/2]

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

Peek into a WriteOnly without advancing the read position.

Parameters
countBytes to peek; 0 = all available.
outBufferDestination writer.
Returns
true on success, false if insufficient data or error.

Same count semantics as the DataType overload.

See also
Read(), Seek()

Implements StormByte::Buffer::ReadOnly.

◆ Read() [1/2]

bool StormByte::Buffer::Ring::Read ( const std::size_t &  count,
DataType outBuffer 
) const
overridevirtualnoexcept

Read into a DataType.

Parameters
countBytes to read; 0 = all available.
outBufferDestination.
Returns
true on success, false on failure.

Implements StormByte::Buffer::ReadOnly.

◆ Read() [2/2]

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

Read into a WriteOnly.

Parameters
countBytes to read; 0 = all available.
outBufferDestination writer.
Returns
true on success, false on failure.

Implements StormByte::Buffer::ReadOnly.

◆ ReadInternal() [1/2]

virtual bool StormByte::Buffer::Ring::ReadInternal ( const std::size_t &  count,
DataType outBuffer,
Operation  flag 
)
protectedvirtualnoexcept

◆ ReadInternal() [2/2]

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

◆ ReadUntilEoF() [1/2]

void StormByte::Buffer::Ring::ReadUntilEoF ( DataType outBuffer) const
overridevirtualnoexcept

Read until EoF into a DataType.

Parameters
outBufferDestination.

Implements StormByte::Buffer::ReadOnly.

◆ ReadUntilEoF() [2/2]

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

Read until EoF into a WriteOnly.

Parameters
outBufferDestination writer.

Implements StormByte::Buffer::ReadOnly.

◆ ReadUntilEoFInternal() [1/2]

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

◆ ReadUntilEoFInternal() [2/2]

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

◆ Seek()

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

Move the logical read position for non-destructive reads.

Parameters
offsetOffset value.
modePosition::Absolute or Position::Relative.

Implements StormByte::Buffer::ReadOnly.

◆ SetError()

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

Enter permanent error state (unreadable and unwritable).

Waiters are notified.

Implements StormByte::Buffer::WriteOnly.

◆ Size()

std::size_t StormByte::Buffer::Ring::Size ( ) const
overridevirtualnoexcept

Total number of bytes stored.

Returns
Size in bytes.

Implements StormByte::Buffer::ReadOnly.

◆ Write() [1/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [2/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [3/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [4/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [5/21]

bool StormByte::Buffer::WriteOnly::Write ( const std::size_t &  count,
const char *  s 
)
inlinenoexcept

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [6/21]

bool StormByte::Buffer::Ring::Write ( const std::size_t &  count,
const DataType data 
)
overridevirtualnoexcept

Append bytes from a DataType (copy).

Parameters
countNumber of bytes to write.
dataSource vector.
Returns
true on success, false if closed / error.
See also
IsWritable()

Implements StormByte::Buffer::WriteOnly.

◆ Write() [7/21]

virtual bool StormByte::Buffer::WriteOnly::Write ( const std::size_t &  count,
const DataType data 
)
virtualnoexcept

Bring WriteOnly convenience Write overloads into scope.

Implements StormByte::Buffer::WriteOnly.

◆ Write() [8/21]

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

Append bytes from a ReadOnly (copy path).

Parameters
countNumber of bytes to write.
dataSource buffer.
Returns
true on success, false if closed / error.
See also
IsWritable()

Implements StormByte::Buffer::WriteOnly.

◆ Write() [9/21]

virtual bool StormByte::Buffer::WriteOnly::Write ( const std::size_t &  count,
const ReadOnly data 
)
virtualnoexcept

Bring WriteOnly convenience Write overloads into scope.

Implements StormByte::Buffer::WriteOnly.

◆ Write() [10/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [11/21]

bool StormByte::Buffer::Ring::Write ( const std::size_t &  count,
DataType &&  data 
)
overridevirtualnoexcept

Append bytes from a DataType (move).

Parameters
countNumber of bytes to write.
dataSource vector.
Returns
true on success, false if closed / error.
See also
IsWritable()

Implements StormByte::Buffer::WriteOnly.

◆ Write() [12/21]

virtual bool StormByte::Buffer::WriteOnly::Write ( const std::size_t &  count,
DataType &&  data 
)
virtualnoexcept

Bring WriteOnly convenience Write overloads into scope.

Implements StormByte::Buffer::WriteOnly.

◆ Write() [13/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [14/21]

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

Append bytes from a ReadOnly (move / extract path).

Parameters
countNumber of bytes to write.
dataSource buffer.
Returns
true on success, false if closed / error.
See also
IsWritable()

Implements StormByte::Buffer::WriteOnly.

◆ Write() [15/21]

virtual bool StormByte::Buffer::WriteOnly::Write ( const std::size_t &  count,
ReadOnly &&  data 
)
virtualnoexcept

Bring WriteOnly convenience Write overloads into scope.

Implements StormByte::Buffer::WriteOnly.

◆ Write() [16/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [17/21]

bool StormByte::Buffer::WriteOnly::Write ( const std::size_t &  count,
std::string_view  sv 
)
inlinenoexcept

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [18/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [19/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [20/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ Write() [21/21]

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

Bring WriteOnly convenience Write overloads into scope.

◆ WriteInternal() [1/2]

virtual bool StormByte::Buffer::Ring::WriteInternal ( const std::size_t &  count,
const DataType src 
)
protectedvirtualnoexcept

◆ WriteInternal() [2/2]

virtual bool StormByte::Buffer::Ring::WriteInternal ( const std::size_t &  count,
DataType &&  src 
)
protectedvirtualnoexcept

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