StormByte-Buffer 2.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
 Default constructor.
 
 Generic (const Generic &other) noexcept=default
 Copy constructor.
 
 Generic (Generic &&other) noexcept=default
 Move constructor.
 
virtual ~Generic () noexcept=0
 Pure virtual destructor.
 
Generic & operator= (const Generic &other)=default
 Copy assignment.
 
Generic & operator= (Generic &&other) noexcept=default
 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 BinaryData DataConvert (const Src &src) noexcept
 Convert an lvalue input range to StormByte::BinaryData.
 
template<Type::ByteInputRange Src>
static BinaryData DataConvert (Src &&src) noexcept
 Convert an rvalue input range to StormByte::BinaryData.
 
static BinaryData DataConvert (std::string_view sv) noexcept
 Convert a string view to StormByte::BinaryData.
 
static BinaryData DataConvert (const char *s) noexcept
 Convert a C string to StormByte::BinaryData.
 

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::BinaryData.

See also
ReadOnly, WriteOnly, ReadWrite

Constructor & Destructor Documentation

◆ Generic() [1/3]

StormByte::Buffer::Generic::Generic ( )
defaultnoexcept

Default constructor.

◆ Generic() [2/3]

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

Copy constructor.

Parameters
otherInstance to copy.

◆ Generic() [3/3]

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

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]

static BinaryData StormByte::Buffer::Generic::DataConvert ( const char *  s)
inlinestaticprotectednoexcept

Convert a C string to StormByte::BinaryData.

Parameters
sSource. Null yields an empty StormByte::BinaryData.
Returns
StormByte::BinaryData.

◆ DataConvert() [2/4]

template<Type::ByteInputRange Src>
static BinaryData StormByte::Buffer::Generic::DataConvert ( const Src &  src)
inlinestaticprotectednoexcept

Convert an lvalue input range to StormByte::BinaryData.

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

◆ DataConvert() [3/4]

template<Type::ByteInputRange Src>
static BinaryData StormByte::Buffer::Generic::DataConvert ( Src &&  src)
inlinestaticprotectednoexcept

Convert an rvalue input range to StormByte::BinaryData.

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

◆ DataConvert() [4/4]

static BinaryData StormByte::Buffer::Generic::DataConvert ( std::string_view  sv)
inlinestaticprotectednoexcept

Convert a string view to StormByte::BinaryData.

No trailing NUL.

Parameters
svSource characters.
Returns
StormByte::BinaryData.

◆ operator=() [1/2]

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

Copy assignment.

Parameters
otherInstance to copy.
Returns
*this.

◆ operator=() [2/2]

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

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: