StormByte C++ Library: Buffer module 1.2.0
StormByte-Buffer is the buffer module of the StormByte C++ suite.
Loading...
Searching...
No Matches
List of all members
StormByte::Buffer::SharedFIFO Class Reference

Thread-safe FIFO built on top of FIFO. More...

#include <StormByte/buffer/shared_fifo.hxx>

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

Public Member Functions

Constructors / destructor / assignment
 SharedFIFO () noexcept=default
 Default construct an empty SharedFIFO.
 
 SharedFIFO (const DataType &data)
 Construct with initial data (copy).
 
 SharedFIFO (DataType &&data) noexcept
 Construct with initial data (move).
 
template<StormByte::Type::ByteInputRange R>
requires (!StormByte::Type::SameAs<R, DataType>)
 SharedFIFO (const R &r) noexcept
 Construct from an input range (copy / convert).
 
template<StormByte::Type::ByteInputRange Rr>
 SharedFIFO (Rr &&r) noexcept
 Construct from an rvalue range.
 
 SharedFIFO (std::string_view sv) noexcept
 Construct from a string view (no trailing NUL).
 
 SharedFIFO (const char *s) noexcept
 Construct from a null-terminated C string.
 
 SharedFIFO (const FIFO &other)
 Construct by copying a plain FIFO.
 
 SharedFIFO (FIFO &&other) noexcept
 Construct by moving a plain FIFO.
 
 SharedFIFO (const SharedFIFO &)=delete
 Copy constructor (deleted – synchronization primitives are not copyable).
 
 SharedFIFO (SharedFIFO &&)=delete
 Move constructor (deleted – mutex / condition_variable are not movable).
 
virtual ~SharedFIFO () noexcept
 Virtual destructor.
 
SharedFIFOoperator= (const FIFO &other)
 Copy-assign from a plain FIFO.
 
SharedFIFOoperator= (FIFO &&other) noexcept
 Move-assign from a plain FIFO.
 
SharedFIFOoperator= (const SharedFIFO &)=delete
 Copy assignment (deleted).
 
SharedFIFOoperator= (SharedFIFO &&)=delete
 Move assignment (deleted – mutex / condition_variable are not movable).
 
Comparison
bool operator== (const SharedFIFO &other) const noexcept
 Equality comparison (thread-safe).
 
bool operator!= (const SharedFIFO &other) const noexcept
 Inequality comparison.
 
Queries
virtual std::size_t AvailableBytes () const noexcept override
 Bytes available from the current read position (thread-safe).
 
virtual const DataTypeData () const noexcept override
 Access the internal storage.
 
virtual bool Empty () const noexcept override
 Whether the underlying storage is empty (thread-safe).
 
virtual bool EoF () const noexcept override
 End-of-stream condition (thread-safe).
 
bool HasError () const noexcept
 Whether the buffer is in permanent error state (thread-safe).
 
virtual bool IsReadable () const noexcept override
 Whether the buffer can still be read (thread-safe).
 
virtual bool IsWritable () const noexcept override
 Whether the buffer accepts writes (thread-safe).
 
virtual std::size_t Size () const noexcept override
 Total number of bytes stored (thread-safe).
 
Maintenance / lifecycle
void Clean () noexcept override
 Discard data from the start up to the read position (thread-safe).
 
virtual void Clear () noexcept override
 Clear all contents (thread-safe).
 
virtual void Close () noexcept override
 Close for further writes (thread-safe).
 
virtual bool Drop (const std::size_t &count) noexcept override
 Discard count unread bytes (thread-safe).
 
virtual void Seek (const std::ptrdiff_t &offset, const Position &mode) const noexcept override
 Move the logical read position (thread-safe).
 
virtual void SetError () noexcept override
 Enter permanent error state (thread-safe).
 
Diagnostics
virtual std::string HexDump (const std::size_t &columns=0, const std::size_t &byte_limit=0) const noexcept override
 Thread-safe hexdump of unread contents.
 
- Public Member Functions inherited from StormByte::Buffer::FIFO
 FIFO () noexcept=default
 Default construct an empty FIFO.
 
 FIFO (const DataType &data) noexcept
 Construct FIFO with initial data (copy).
 
 FIFO (DataType &&data) noexcept
 Construct FIFO with initial data (move).
 
template<Type::ByteInputRange R>
requires (!Type::SameAs<R, DataType>)
 FIFO (const R &r) noexcept
 Construct FIFO from an input range (copy / convert).
 
template<Type::ByteInputRange Rr>
 FIFO (Rr &&r) noexcept
 Construct FIFO from an rvalue range (moves when DataType).
 
 FIFO (std::string_view sv) noexcept
 Construct FIFO from a string view (no trailing NUL).
 
 FIFO (const char *s) noexcept
 Construct FIFO from a null-terminated C string.
 
 FIFO (const FIFO &other) noexcept
 Copy construct, preserving buffer contents and state.
 
 FIFO (FIFO &&other) noexcept
 Move construct.
 
virtual ~FIFO () noexcept
 Virtual destructor.
 
FIFOoperator= (const FIFO &other)
 Copy assign, preserving buffer contents and state.
 
FIFOoperator= (FIFO &&other) noexcept
 Move assign.
 
bool operator== (const FIFO &other) const noexcept
 Equality comparison.
 
bool operator!= (const FIFO &other) const noexcept
 Inequality comparison.
 
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 all remaining bytes until EoF into a DataType.
 
void ExtractUntilEoF (WriteOnly &outBuffer) noexcept override
 Extract all remaining bytes until EoF into a WriteOnly.
 
virtual bool Extract (const std::size_t &count, DataType &outBuffer) noexcept=0
 Bring ReadOnly convenience Extract overloads into scope.
 
bool Extract (DataType &outBuffer) noexcept
 Bring ReadOnly convenience Extract overloads into scope.
 
virtual bool Extract (const std::size_t &count, WriteOnly &outBuffer) noexcept=0
 Bring ReadOnly convenience Extract overloads into scope.
 
bool Extract (WriteOnly &outBuffer) noexcept
 Bring ReadOnly convenience Extract overloads into scope.
 
bool Read (const std::size_t &count, DataType &outBuffer) const noexcept override
 Non-destructive read into a DataType (advances position).
 
bool Read (const std::size_t &count, WriteOnly &outBuffer) const noexcept override
 Non-destructive read into a WriteOnly (advances position).
 
void ReadUntilEoF (DataType &outBuffer) const noexcept override
 Read all remaining bytes until EoF into a DataType.
 
void ReadUntilEoF (WriteOnly &outBuffer) const noexcept override
 Read all remaining bytes until EoF into a WriteOnly.
 
virtual bool Read (const std::size_t &count, DataType &outBuffer) const noexcept=0
 Bring ReadOnly convenience Read overloads into scope.
 
bool Read (DataType &outBuffer) const noexcept
 Bring ReadOnly convenience Read overloads into scope.
 
virtual bool Read (const std::size_t &count, WriteOnly &outBuffer) const noexcept=0
 Bring ReadOnly convenience Read overloads into scope.
 
bool Read (WriteOnly &outBuffer) const noexcept
 Bring ReadOnly convenience Read overloads into scope.
 
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.
 
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 source (copy).
 
bool Write (const std::size_t &count, ReadOnly &&data) noexcept override
 Append bytes from a ReadOnly source (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.
 

Additional Inherited Members

- Protected Types inherited from StormByte::Buffer::FIFO
enum class  Operation { Extract , Read , Peek }
 Kind of internal read operation. More...
 
- Protected Member Functions inherited from StormByte::Buffer::FIFO
std::size_t AvailableBytesInternal () const noexcept
 Return unread bytes without virtual dispatch.
 
virtual void ReadUntilEoFInternal (DataType &outBuffer, const Operation &flag) noexcept
 Drain until EoF into DataType using flag semantics.
 
virtual void ReadUntilEoFInternal (WriteOnly &outBuffer, const Operation &flag) noexcept
 Drain until EoF into WriteOnly using flag semantics.
 
virtual bool WriteInternal (const std::size_t &count, const ReadOnly &src) noexcept
 Append from ReadOnly (copy path).
 
virtual bool WriteInternal (const std::size_t &count, ReadOnly &&src) noexcept
 Append from ReadOnly (move / extract path).
 
- Static Protected Member Functions inherited from StormByte::Buffer::FIFO
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.
 
- Protected Attributes inherited from StormByte::Buffer::FIFO
DataType m_buffer
 Owned contiguous byte storage.
 
std::size_t m_position_offset {0}
 Logical read offset from start of m_buffer.
 
bool m_closed {false}
 Once true, further writes fail.
 
bool m_error {false}
 Permanent error: unreadable and unwritable.
 

Detailed Description

Thread-safe FIFO built on top of FIFO.

Overview
SharedFIFO wraps the non-thread-safe FIFO with a mutex and a condition variable to provide safe concurrent access from multiple producer / consumer threads. It preserves the byte-oriented FIFO semantics of FIFO while adding blocking behaviour for reads and extracts.
Blocking semantics
  • Read / Extract with count > 0 block until that many bytes are available from the current position, or until the FIFO is closed / set to error via Close() / SetError().
  • If count == 0, the call returns immediately with all bytes currently available (Extract may clear them).
Close behaviour
Close() marks the FIFO as closed (base class flag) and notifies all waiting threads. Subsequent Write() calls fail. Waiters wake and complete using whatever data is presently available (which may be none).
Error behaviour
SetError() puts the buffer into a permanent error state (unreadable and unwritable) and wakes all waiters.
Seek behaviour
Seek() updates the non-destructive read position and notifies waiters so blocked readers can re-evaluate their predicates.
Thread safety
All public member functions are thread-safe. Mutators and accessors take the internal mutex as needed for a consistent view.
Note
Closed / error flags are owned by the base FIFO. SharedFIFO only protects access and notifies waiters.
See also
FIFO, Ring, Producer, Consumer

Constructor & Destructor Documentation

◆ SharedFIFO() [1/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( )
defaultnoexcept

Default construct an empty SharedFIFO.

Behaves like FIFO and may grow as needed.

◆ SharedFIFO() [2/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( const DataType data)
inline

Construct with initial data (copy).

Parameters
dataInitial byte vector.

◆ SharedFIFO() [3/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( DataType &&  data)
inlinenoexcept

Construct with initial data (move).

Parameters
dataInitial byte vector (moved into the base FIFO).

◆ SharedFIFO() [4/11]

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

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).

◆ SharedFIFO() [5/11]

template<StormByte::Type::ByteInputRange Rr>
StormByte::Buffer::SharedFIFO::SharedFIFO ( Rr &&  r)
inlinenoexcept

Construct from an rvalue range.

Template Parameters
RrRange type.
Parameters
rSource range (moved when DataType).

◆ SharedFIFO() [6/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( std::string_view  sv)
inlinenoexcept

Construct from a string view (no trailing NUL).

Parameters
svSource characters.

◆ SharedFIFO() [7/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( const char *  s)
inlinenoexcept

Construct from a null-terminated C string.

Parameters
sSource string (may be null → empty).

◆ SharedFIFO() [8/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( const FIFO other)
inline

Construct by copying a plain FIFO.

Parameters
otherSource FIFO.

◆ SharedFIFO() [9/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( FIFO &&  other)
inlinenoexcept

Construct by moving a plain FIFO.

Parameters
otherSource FIFO (left empty after move).

◆ SharedFIFO() [10/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( const SharedFIFO )
delete

Copy constructor (deleted – synchronization primitives are not copyable).

◆ SharedFIFO() [11/11]

StormByte::Buffer::SharedFIFO::SharedFIFO ( SharedFIFO &&  )
delete

Move constructor (deleted – mutex / condition_variable are not movable).

◆ ~SharedFIFO()

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

Virtual destructor.

Member Function Documentation

◆ AvailableBytes()

virtual std::size_t StormByte::Buffer::SharedFIFO::AvailableBytes ( ) const
overridevirtualnoexcept

Bytes available from the current read position (thread-safe).

Returns
Unread byte count.

Reimplemented from StormByte::Buffer::FIFO.

◆ Clean()

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

Discard data from the start up to the read position (thread-safe).

See also
FIFO::Clean()

Reimplemented from StormByte::Buffer::FIFO.

◆ Clear()

virtual void StormByte::Buffer::SharedFIFO::Clear ( )
overridevirtualnoexcept

Clear all contents (thread-safe).

Does not clear closed / error flags.

See also
FIFO::Clear()

Reimplemented from StormByte::Buffer::FIFO.

◆ Close()

virtual void StormByte::Buffer::SharedFIFO::Close ( )
overridevirtualnoexcept

Close for further writes (thread-safe).

Marks closed via the base class and notifies all waiters. Subsequent writes fail; remaining data stays readable.

See also
FIFO::Close(), IsWritable()

Reimplemented from StormByte::Buffer::FIFO.

◆ Data()

virtual const DataType & StormByte::Buffer::SharedFIFO::Data ( ) const
overridevirtualnoexcept

Access the internal storage.

Warning
Not safe under concurrent mutation without external exclusion.
Returns
Constant reference to the base DataType.

Reimplemented from StormByte::Buffer::FIFO.

◆ Drop()

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

Discard count unread bytes (thread-safe).

Parameters
countNumber of bytes to drop.
Returns
true on success, false otherwise.

Notifies waiting readers after dropping.

See also
FIFO::Drop()

Reimplemented from StormByte::Buffer::FIFO.

◆ Empty()

virtual bool StormByte::Buffer::SharedFIFO::Empty ( ) const
overridevirtualnoexcept

Whether the underlying storage is empty (thread-safe).

Returns
true if empty.
Note
With a non-zero read position, Empty() may be false while AvailableBytes() is zero.
See also
Size(), AvailableBytes()

Reimplemented from StormByte::Buffer::FIFO.

◆ EoF()

virtual bool StormByte::Buffer::SharedFIFO::EoF ( ) const
overridevirtualnoexcept

End-of-stream condition (thread-safe).

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

Reimplemented from StormByte::Buffer::FIFO.

◆ HasError()

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

Whether the buffer is in permanent error state (thread-safe).

Returns
true after SetError().

◆ HexDump()

virtual std::string StormByte::Buffer::SharedFIFO::HexDump ( const std::size_t &  columns = 0,
const std::size_t &  byte_limit = 0 
) const
overridevirtualnoexcept

Thread-safe hexdump of unread contents.

Parameters
columnsBytes per line (0 → default 16).
byte_limitMax bytes to include (0 → no limit).
Returns
Formatted dump (size / position / status + hex/ASCII; no trailing newline).

Acquires the mutex for a consistent snapshot.

Reimplemented from StormByte::Buffer::FIFO.

◆ IsReadable()

virtual bool StormByte::Buffer::SharedFIFO::IsReadable ( ) const
overridevirtualnoexcept

Whether the buffer can still be read (thread-safe).

Returns
false in permanent error state.
See also
SetError(), IsWritable(), AvailableBytes(), EoF()

Reimplemented from StormByte::Buffer::FIFO.

◆ IsWritable()

virtual bool StormByte::Buffer::SharedFIFO::IsWritable ( ) const
overridevirtualnoexcept

Whether the buffer accepts writes (thread-safe).

Returns
false if closed or in error.
See also
Close(), SetError(), IsReadable()

Reimplemented from StormByte::Buffer::FIFO.

◆ operator!=()

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

Inequality comparison.

Parameters
otherOther SharedFIFO.
Returns
Negation of operator==.

◆ operator=() [1/4]

SharedFIFO & StormByte::Buffer::SharedFIFO::operator= ( const FIFO other)

Copy-assign from a plain FIFO.

Parameters
otherSource FIFO.
Returns
Reference to this SharedFIFO.

◆ operator=() [2/4]

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

Copy assignment (deleted).

◆ operator=() [3/4]

SharedFIFO & StormByte::Buffer::SharedFIFO::operator= ( FIFO &&  other)
noexcept

Move-assign from a plain FIFO.

Parameters
otherSource FIFO.
Returns
Reference to this SharedFIFO.

◆ operator=() [4/4]

SharedFIFO & StormByte::Buffer::SharedFIFO::operator= ( SharedFIFO &&  )
delete

Move assignment (deleted – mutex / condition_variable are not movable).

◆ operator==()

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

Equality comparison (thread-safe).

Parameters
otherOther SharedFIFO.
Returns
true if contents and state match (both mutexes held).

Delegates to FIFO::operator== under dual locks.

◆ Seek()

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

Move the logical read position (thread-safe).

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

Position is clamped to [0, Size()]. Notifies waiters.

See also
Read(), Position

Reimplemented from StormByte::Buffer::FIFO.

◆ SetError()

virtual void StormByte::Buffer::SharedFIFO::SetError ( )
overridevirtualnoexcept

Enter permanent error state (thread-safe).

Marks error via the base class and notifies all waiters.

See also
FIFO::SetError(), IsReadable(), IsWritable()

Reimplemented from StormByte::Buffer::FIFO.

◆ Size()

virtual std::size_t StormByte::Buffer::SharedFIFO::Size ( ) const
overridevirtualnoexcept

Total number of bytes stored (thread-safe).

Returns
Size in bytes.
See also
Empty(), AvailableBytes()

Reimplemented from StormByte::Buffer::FIFO.


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