fiber
Loading...
Searching...
No Matches
fiber::StaticLinearAllocator< Bytes > Struct Template Reference

A linear allocator that uses stack memory and follows std::pmr::memory_resource More...

#include <StaticLinearAllocator.hpp>

Inheritance diagram for fiber::StaticLinearAllocator< Bytes >:

Classes

struct  Header
 

Public Types

using word = uint32_t
 

Public Member Functions

 StaticLinearAllocator ()
 
Headerheader (size_t index)
 
template<class Stream>
void dump (Stream &stream)
 
bool empty ()
 
void combine_free (std::size_t index)
 
void * do_allocate (const std::size_t size, const std::size_t alignment) final
 
void do_deallocate (void *ptr, std::size_t bytes, std::size_t alignment) final
 
bool do_is_equal (const std::pmr::memory_resource &other) const noexcept final
 

Public Attributes

word buffer [bufferSize]
 

Static Public Attributes

static constexpr size_t bufferSize = Bytes / sizeof(word)
 

Detailed Description

template<size_t Bytes>
struct fiber::StaticLinearAllocator< Bytes >

A linear allocator that uses stack memory and follows std::pmr::memory_resource

Template Parameters
BytesThe number of bytes (rounded up to multiple of 4)

Member Typedef Documentation

◆ word

template<size_t Bytes>
using fiber::StaticLinearAllocator< Bytes >::word = uint32_t

Constructor & Destructor Documentation

◆ StaticLinearAllocator()

template<size_t Bytes>
fiber::StaticLinearAllocator< Bytes >::StaticLinearAllocator ( )
inline

Member Function Documentation

◆ combine_free()

template<size_t Bytes>
void fiber::StaticLinearAllocator< Bytes >::combine_free ( std::size_t index)
inline

◆ do_allocate()

template<size_t Bytes>
void * fiber::StaticLinearAllocator< Bytes >::do_allocate ( const std::size_t size,
const std::size_t alignment )
inlinefinal

◆ do_deallocate()

template<size_t Bytes>
void fiber::StaticLinearAllocator< Bytes >::do_deallocate ( void * ptr,
std::size_t bytes,
std::size_t alignment )
inlinefinal

◆ do_is_equal()

template<size_t Bytes>
bool fiber::StaticLinearAllocator< Bytes >::do_is_equal ( const std::pmr::memory_resource & other) const
inlinefinalnoexcept

◆ dump()

template<size_t Bytes>
template<class Stream>
void fiber::StaticLinearAllocator< Bytes >::dump ( Stream & stream)
inline

◆ empty()

template<size_t Bytes>
bool fiber::StaticLinearAllocator< Bytes >::empty ( )
inline

◆ header()

template<size_t Bytes>
Header * fiber::StaticLinearAllocator< Bytes >::header ( size_t index)
inline

Member Data Documentation

◆ buffer

template<size_t Bytes>
word fiber::StaticLinearAllocator< Bytes >::buffer[bufferSize]

◆ bufferSize

template<size_t Bytes>
size_t fiber::StaticLinearAllocator< Bytes >::bufferSize = Bytes / sizeof(word)
staticconstexpr

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