qxLib
Public Member Functions | List of all members
qx::sbo_bytes< traits_t > Class Template Reference

A type erased small buffer object that works with raw data. More...

#include <sbo_bytes.h>

Public Member Functions

bool resize (size_type nNewSize, size_type nAlignment, sbo_resize_type eSboResizeType, bool bMemmove) noexcept
 Resize SBO. More...
 
void free () noexcept
 Free allocated memory.
 
std::byte * data () noexcept
 Get SBO data: from a buffer or from a heap. More...
 
const std::byte * data () const noexcept
 Get SBO data: from a buffer or from a heap. More...
 
size_type size () const noexcept
 Get SBO size (bytes) More...
 
size_type capacity () const noexcept
 Get SBO capacity (bytes) More...
 
bool is_small () const noexcept
 Is the SBO small and fits into the local buffer. More...
 

Detailed Description

template<class traits_t>
class qx::sbo_bytes< traits_t >

A type erased small buffer object that works with raw data.

Template Parameters
traits_t- SBO traits type
Author
Khrapov
Date
20.12.2025

Definition at line 36 of file sbo_bytes.h.

Member Function Documentation

◆ capacity()

template<class traits_t >
sbo_bytes< traits_t >::size_type qx::sbo_bytes< traits_t >::capacity ( void  ) const
noexcept

Get SBO capacity (bytes)

Return values
-SBO capacity (bytes), can't be less than nSBOSize

Definition at line 160 of file sbo_bytes.inl.

◆ data() [1/2]

template<class traits_t >
const std::byte * qx::sbo_bytes< traits_t >::data
noexcept

Get SBO data: from a buffer or from a heap.

Return values
-SBO data pointer

Definition at line 148 of file sbo_bytes.inl.

◆ data() [2/2]

template<class traits_t >
std::byte * qx::sbo_bytes< traits_t >::data
noexcept

Get SBO data: from a buffer or from a heap.

Return values
-SBO data pointer

Definition at line 139 of file sbo_bytes.inl.

◆ is_small()

template<class traits_t >
bool qx::sbo_bytes< traits_t >::is_small
noexcept

Is the SBO small and fits into the local buffer.

Return values
-true if the SBO is small and fits into the local buffer

Definition at line 169 of file sbo_bytes.inl.

◆ resize()

template<class traits_t >
bool qx::sbo_bytes< traits_t >::resize ( size_type  nNewSize,
size_type  nAlignment,
sbo_resize_type  eSboResizeType,
bool  bMemmove 
)
noexcept

Resize SBO.

Parameters
nNewSize- new size (bytes)
nAlignment- alignment (if 16 then size 13->16 16->16 18->32)
eSboResizeType- a resize type
bMemmove- in case the content is relocated, should we call memmove or the callee will handle the moving?
Return values
-true if memory alloc is successful

Definition at line 58 of file sbo_bytes.inl.

◆ size()

template<class traits_t >
sbo_bytes< traits_t >::size_type qx::sbo_bytes< traits_t >::size
noexcept

Get SBO size (bytes)

Return values
-SBO size (bytes)

Definition at line 154 of file sbo_bytes.inl.


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