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

Shared charge that can explicitly follow one payload across queues or work. More...

#include <StormByte/buffer/byte_budget.hxx>

Public Member Functions

 Lease () noexcept=default
 Construct an empty charge.
 Lease (const Lease &other) noexcept=default
 Share an existing charge without reserving twice.
 Lease (Lease &&other) noexcept=default
 Transfer a charge.
 ~Lease () noexcept=default
 Release this reference; final release returns bytes.
Lease & operator= (const Lease &other) noexcept=default
 Replace this reference with a shared charge.
Lease & operator= (Lease &&other) noexcept=default
 Replace this reference with a transferred charge.
 operator bool () const noexcept
 Whether a charge is owned, including a zero-byte charge.
StormByte::ByteSize Bytes () const noexcept
 Size reserved once for all copies.
bool BelongsTo (const ByteBudget &budget) const noexcept
 Check shared budget identity.
void Reset () noexcept
 Release this reference.

Friends

class ByteBudget

Detailed Description

Shared charge that can explicitly follow one payload across queues or work.

Constructor & Destructor Documentation

◆ Lease() [1/3]

StormByte::Buffer::ByteBudget::Lease::Lease ( )
defaultnoexcept

Construct an empty charge.

◆ Lease() [2/3]

StormByte::Buffer::ByteBudget::Lease::Lease ( const Lease & other)
defaultnoexcept

Share an existing charge without reserving twice.

Parameters
otherSource lease.

◆ Lease() [3/3]

StormByte::Buffer::ByteBudget::Lease::Lease ( Lease && other)
defaultnoexcept

Transfer a charge.

Parameters
otherSource, left empty.

◆ ~Lease()

StormByte::Buffer::ByteBudget::Lease::~Lease ( )
defaultnoexcept

Release this reference; final release returns bytes.

Member Function Documentation

◆ BelongsTo()

bool StormByte::Buffer::ByteBudget::Lease::BelongsTo ( const ByteBudget & budget) const
noexcept

Check shared budget identity.

Parameters
budgetCandidate budget.
Returns
True when charged to that budget.

◆ Bytes()

StormByte::ByteSize StormByte::Buffer::ByteBudget::Lease::Bytes ( ) const
noexcept

Size reserved once for all copies.

Returns
Logical bytes.

◆ operator bool()

StormByte::Buffer::ByteBudget::Lease::operator bool ( ) const
explicitnoexcept

Whether a charge is owned, including a zero-byte charge.

Returns
True for a live charge.

◆ operator=() [1/2]

Lease & StormByte::Buffer::ByteBudget::Lease::operator= ( const Lease & other)
defaultnoexcept

Replace this reference with a shared charge.

Parameters
otherSource lease.
Returns
This lease.

◆ operator=() [2/2]

Lease & StormByte::Buffer::ByteBudget::Lease::operator= ( Lease && other)
defaultnoexcept

Replace this reference with a transferred charge.

Parameters
otherSource, left empty.
Returns
This lease.

◆ Reset()

void StormByte::Buffer::ByteBudget::Lease::Reset ( )
noexcept

Release this reference.

◆ ByteBudget

friend class ByteBudget
friend

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