libcopp  2.2.0
Public Types | Public Member Functions | Private Attributes
allocator::stack_allocator_pool< TPool > Class Template Reference

memory allocator this allocator will maintain buffer using malloc/free function More...

#include <stack_allocator_pool.h>

Collaboration diagram for allocator::stack_allocator_pool< TPool >:
Collaboration graph

Public Types

using pool_type = TPool
 
using pool_t = pool_type
 

Public Member Functions

 stack_allocator_pool () LIBCOPP_MACRO_NOEXCEPT
 
 stack_allocator_pool (const std::shared_ptr< pool_type > &p) LIBCOPP_MACRO_NOEXCEPT
 
 ~stack_allocator_pool ()
 
void attach (const std::shared_ptr< pool_type > &p) LIBCOPP_MACRO_NOEXCEPT
 
void allocate (stack_context &ctx, std::size_t) LIBCOPP_MACRO_NOEXCEPT
 
void deallocate (stack_context &ctx) LIBCOPP_MACRO_NOEXCEPT
 

Private Attributes

std::shared_ptr< pool_typepool_
 

Detailed Description

template<typename TPool>
class allocator::stack_allocator_pool< TPool >

memory allocator this allocator will maintain buffer using malloc/free function

Definition at line 27 of file stack_allocator_pool.h.

Member Typedef Documentation

◆ pool_t

template<typename TPool >
using allocator::stack_allocator_pool< TPool >::pool_t = pool_type

Definition at line 32 of file stack_allocator_pool.h.

◆ pool_type

template<typename TPool >
using allocator::stack_allocator_pool< TPool >::pool_type = TPool

Definition at line 29 of file stack_allocator_pool.h.

Constructor & Destructor Documentation

◆ stack_allocator_pool() [1/2]

template<typename TPool >
allocator::stack_allocator_pool< TPool >::stack_allocator_pool ( )
inline

Definition at line 35 of file stack_allocator_pool.h.

◆ stack_allocator_pool() [2/2]

template<typename TPool >
allocator::stack_allocator_pool< TPool >::stack_allocator_pool ( const std::shared_ptr< pool_type > &  p)
inline

Definition at line 36 of file stack_allocator_pool.h.

◆ ~stack_allocator_pool()

template<typename TPool >
allocator::stack_allocator_pool< TPool >::~stack_allocator_pool ( )
inline

Definition at line 37 of file stack_allocator_pool.h.

Member Function Documentation

◆ allocate()

template<typename TPool >
void allocator::stack_allocator_pool< TPool >::allocate ( stack_context ctx,
std::size_t   
)
inline

allocate memory and attach to stack context [standard function]

Parameters
ctxstack context
sizeignored
Note
size must less or equal than attached

Definition at line 53 of file stack_allocator_pool.h.

◆ attach()

template<typename TPool >
void allocator::stack_allocator_pool< TPool >::attach ( const std::shared_ptr< pool_type > &  p)
inline

specify memory section allocated

Parameters
start_ptrbuffer start address
max_sizebuffer size
Note
must be called before allocate operation

Definition at line 45 of file stack_allocator_pool.h.

◆ deallocate()

template<typename TPool >
void allocator::stack_allocator_pool< TPool >::deallocate ( stack_context ctx)
inline

deallocate memory from stack context [standard function]

Parameters
ctxstack context

Definition at line 64 of file stack_allocator_pool.h.

Field Documentation

◆ pool_

template<typename TPool >
std::shared_ptr<pool_type> allocator::stack_allocator_pool< TPool >::pool_
private

Definition at line 72 of file stack_allocator_pool.h.


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