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

Read and write interface. More...

#include <StormByte/buffer/generic.hxx>

Inheritance diagram for StormByte::Buffer::ReadWrite:
Collaboration diagram for StormByte::Buffer::ReadWrite:

Public Member Functions

Lifecycle
 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.
virtual StormByte::ByteSize Available () const noexcept=0
 Bytes available from the current read position.
virtual const Safe::Binary & Data () const noexcept=0
 View of internal storage.
virtual bool Empty () const noexcept=0
 Whether the store holds no bytes.
virtual bool EoF () const noexcept=0
 End of stream.
virtual bool IsReadable () const noexcept=0
 Whether the buffer can still be read.
virtual void Clean () noexcept=0
 Drop bytes from the start up to the current read position.
virtual void Clear () noexcept=0
 Clear stored bytes and reset logical positions.
virtual bool Drop (const StormByte::ByteSize &count) noexcept=0
 Discard count unread bytes.
virtual void Seek (const std::ptrdiff_t &offset, const Position &mode) const noexcept=0
 Move the logical read position.
virtual bool Extract (const StormByte::ByteSize &count, StormByte::Safe::Binary &outBuffer) noexcept=0
 Extract bytes into a StormByte::Safe::Binary.
bool Extract (StormByte::Safe::Binary &outBuffer) noexcept
 Extract all available bytes into a StormByte::Safe::Binary.
virtual bool Extract (const StormByte::ByteSize &count, WriteOnly &outBuffer) noexcept=0
 Extract bytes into a WriteOnly.
bool Extract (WriteOnly &outBuffer) noexcept
 Extract all available bytes into a WriteOnly.
virtual void ExtractUntilEoF (StormByte::Safe::Binary &outBuffer) noexcept=0
 Extract until EoF into a StormByte::Safe::Binary.
virtual void ExtractUntilEoF (WriteOnly &outBuffer) noexcept=0
 Extract until EoF into a WriteOnly.
virtual bool Peek (const StormByte::ByteSize &count, StormByte::Safe::Binary &outBuffer) const noexcept=0
 Peek into a StormByte::Safe::Binary.
virtual bool Peek (const StormByte::ByteSize &count, WriteOnly &outBuffer) const noexcept=0
 Peek into a WriteOnly.
virtual bool Read (const StormByte::ByteSize &count, StormByte::Safe::Binary &outBuffer) const noexcept=0
 Read into a StormByte::Safe::Binary.
bool Read (StormByte::Safe::Binary &outBuffer) const noexcept
 Read all available bytes into a StormByte::Safe::Binary.
virtual bool Read (const StormByte::ByteSize &count, WriteOnly &outBuffer) const noexcept=0
 Read into a WriteOnly.
bool Read (WriteOnly &outBuffer) const noexcept
 Read all available bytes into a WriteOnly.
virtual void ReadUntilEoF (StormByte::Safe::Binary &outBuffer) const noexcept=0
 Read until EoF into a StormByte::Safe::Binary.
virtual void ReadUntilEoF (WriteOnly &outBuffer) const noexcept=0
 Read until EoF 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.
virtual StormByte::ByteSize Size () const noexcept=0
 Total number of bytes stored.
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.
virtual bool IsWritable () const noexcept=0
 Whether the buffer accepts writes.
virtual void Close () noexcept=0
 Stop further writes.
virtual void SetError () noexcept=0
 Permanent error.
virtual bool Write (const StormByte::ByteSize &count, const Safe::Binary &data) noexcept=0
 Append bytes from a StormByte::Safe::Binary (copy).
virtual bool Write (const StormByte::ByteSize &count, Safe::Binary &&data) noexcept=0
 Append bytes from a StormByte::Safe::Binary (move).
virtual bool Write (const StormByte::ByteSize &count, const ReadOnly &data) noexcept=0
 Append bytes from a ReadOnly (copy).
virtual bool Write (const StormByte::ByteSize &count, ReadOnly &&data) noexcept=0
 Append bytes from a ReadOnly (extract).
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.

Additional Inherited Members

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

Read and write interface.

FIFO and Ring implement this.

See also
ReadOnly, WriteOnly, Generic

Constructor & Destructor Documentation

◆ ReadWrite() [1/3]

StormByte::Buffer::ReadWrite::ReadWrite ( )
noexcept

Default constructor.

◆ ReadWrite() [2/3]

StormByte::Buffer::ReadWrite::ReadWrite ( const ReadWrite & other)
noexcept

Copy constructor.

Parameters
otherInstance to copy.

◆ ReadWrite() [3/3]

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

Move constructor.

Parameters
otherInstance to take from.

◆ ~ReadWrite()

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

Destructor.

Member Function Documentation

◆ operator=() [1/2]

ReadWrite & StormByte::Buffer::ReadWrite::operator= ( const ReadWrite & other)
noexcept

Copy assignment.

Parameters
otherInstance to copy.
Returns
*this.

◆ operator=() [2/2]

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

Move assignment.

Parameters
otherInstance to take from.
Returns
*this.

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