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

Abstract root of the byte-buffer interfaces. More...

#include <StormByte/buffer/generic.hxx>

Inheritance diagram for StormByte::Buffer::Generic:

Public Member Functions

Lifecycle
 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.
Queries
virtual StormByte::ByteSize Size () const noexcept=0
 Total number of bytes stored.

Static Protected Member Functions

DataConvert
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

Abstract root of the byte-buffer interfaces.

No data members. Concrete types own storage. Size is declared here so every buffer (read, write or both) reports occupancy. Protected DataConvert helpers turn ranges and strings into StormByte::Safe::Binary.

See also
ReadOnly, WriteOnly, ReadWrite

Constructor & Destructor Documentation

◆ Generic() [1/3]

StormByte::Buffer::Generic::Generic ( )
noexcept

Default constructor.

◆ Generic() [2/3]

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

Copy constructor.

Parameters
otherInstance to copy.

◆ Generic() [3/3]

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

Move constructor.

Parameters
otherInstance to take from.

◆ ~Generic()

virtual StormByte::Buffer::Generic::~Generic ( )
pure virtualnoexcept

Pure virtual destructor.

Keeps the class abstract.

Member Function Documentation

◆ DataConvert() [1/4]

Safe::Binary StormByte::Buffer::Generic::DataConvert ( const char * s)
staticprotectednoexcept

Convert a C string to StormByte::Safe::Binary.

Parameters
sSource. Null yields an empty StormByte::Safe::Binary.
Returns
StormByte::Safe::Binary.

◆ DataConvert() [2/4]

template<Type::ByteInputRange Src>
STORMBYTE_FORCE_INLINE Safe::Binary StormByte::Buffer::Generic::DataConvert ( const Src & src)
inlinestaticprotectednoexcept

Convert an lvalue input range to StormByte::Safe::Binary.

Template Parameters
SrcRange whose value_type converts to std::byte.
Parameters
srcSource range.
Returns
Converted StormByte::Safe::Binary.

◆ DataConvert() [3/4]

template<Type::ByteInputRange Src>
STORMBYTE_FORCE_INLINE Safe::Binary StormByte::Buffer::Generic::DataConvert ( Src && src)
inlinestaticprotectednoexcept

Convert an rvalue input range to StormByte::Safe::Binary.

Template Parameters
SrcRange type. Moved when already StormByte::Safe::Binary.
Parameters
srcSource range.
Returns
Converted or moved StormByte::Safe::Binary.

◆ DataConvert() [4/4]

Safe::Binary StormByte::Buffer::Generic::DataConvert ( std::string_view sv)
staticprotectednoexcept

Convert a string view to StormByte::Safe::Binary.

No trailing NUL.

Parameters
svSource characters.
Returns
StormByte::Safe::Binary.

◆ operator=() [1/2]

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

Copy assignment.

Parameters
otherInstance to copy.
Returns
*this.

◆ operator=() [2/2]

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

Move assignment.

Parameters
otherInstance to take from.
Returns
*this.

◆ Size()

virtual StormByte::ByteSize StormByte::Buffer::Generic::Size ( ) const
pure virtualnoexcept

Total number of bytes stored.

Returns
Size in bytes. 0 if the store is empty.

Implemented in StormByte::Buffer::Consumer, StormByte::Buffer::FIFO, StormByte::Buffer::Producer, StormByte::Buffer::Ring, and StormByte::Buffer::SharedFIFO.


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