libcopp  2.2.0
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
stack_pool< TAlloc > Class Template Reference

#include <stack_pool.h>

Collaboration diagram for stack_pool< TAlloc >:
Collaboration graph

Data Structures

struct  configure_t
 
struct  constructor_delegator
 
struct  limit_t
 

Public Types

using allocator_type = TAlloc
 
using ptr_type = std::shared_ptr< stack_pool< TAlloc > >
 
using allocator_t = allocator_type
 
using ptr_t = ptr_type
 

Public Member Functions

 stack_pool (constructor_delegator)
 
 ~stack_pool ()
 
const limit_tget_limit () const
 
allocator_typeget_origin_allocator () LIBCOPP_MACRO_NOEXCEPT
 
const allocator_typeget_origin_allocator () const LIBCOPP_MACRO_NOEXCEPT
 
size_t set_stack_size (size_t sz)
 
size_t get_stack_size () const
 
size_t get_stack_size_offset () const
 
void set_max_stack_size (size_t sz) LIBCOPP_MACRO_NOEXCEPT
 
size_t get_max_stack_size () const LIBCOPP_MACRO_NOEXCEPT
 
void set_max_stack_number (size_t sz) LIBCOPP_MACRO_NOEXCEPT
 
size_t get_max_stack_number () const LIBCOPP_MACRO_NOEXCEPT
 
void set_min_stack_size (size_t sz) LIBCOPP_MACRO_NOEXCEPT
 
size_t get_min_stack_size () const LIBCOPP_MACRO_NOEXCEPT
 
void set_min_stack_number (size_t sz) LIBCOPP_MACRO_NOEXCEPT
 
size_t get_min_stack_number () const LIBCOPP_MACRO_NOEXCEPT
 
void set_auto_gc (bool v) LIBCOPP_MACRO_NOEXCEPT
 
bool is_auto_gc () const LIBCOPP_MACRO_NOEXCEPT
 
void set_gc_once_number (size_t v) LIBCOPP_MACRO_NOEXCEPT
 
size_t get_gc_once_number () const LIBCOPP_MACRO_NOEXCEPT
 
void allocate (stack_context &ctx) LIBCOPP_MACRO_NOEXCEPT
 
void deallocate (stack_context &ctx) LIBCOPP_MACRO_NOEXCEPT
 
size_t gc ()
 
void clear ()
 

Static Public Member Functions

static ptr_type create ()
 

Private Member Functions

 stack_pool ()=delete
 
 stack_pool (const stack_pool &)=delete
 

Private Attributes

limit_t limits_
 
configure_t conf_
 
allocator_type alloc_
 
LIBCOPP_COPP_NAMESPACE_ID::util::lock::spin_lock action_lock_
 
std::list< stack_contextfree_list_
 

Detailed Description

template<typename TAlloc>
class stack_pool< TAlloc >

Definition at line 27 of file stack_pool.h.

Member Typedef Documentation

◆ allocator_t

template<typename TAlloc >
using stack_pool< TAlloc >::allocator_t = allocator_type

Definition at line 33 of file stack_pool.h.

◆ allocator_type

template<typename TAlloc >
using stack_pool< TAlloc >::allocator_type = TAlloc

Definition at line 29 of file stack_pool.h.

◆ ptr_t

template<typename TAlloc >
using stack_pool< TAlloc >::ptr_t = ptr_type

Definition at line 34 of file stack_pool.h.

◆ ptr_type

template<typename TAlloc >
using stack_pool< TAlloc >::ptr_type = std::shared_ptr<stack_pool<TAlloc> >

Definition at line 30 of file stack_pool.h.

Constructor & Destructor Documentation

◆ stack_pool() [1/3]

template<typename TAlloc >
stack_pool< TAlloc >::stack_pool ( )
privatedelete

◆ stack_pool() [2/3]

template<typename TAlloc >
stack_pool< TAlloc >::stack_pool ( const stack_pool< TAlloc > &  )
privatedelete

◆ stack_pool() [3/3]

template<typename TAlloc >
stack_pool< TAlloc >::stack_pool ( constructor_delegator  )
inline

Definition at line 63 of file stack_pool.h.

◆ ~stack_pool()

template<typename TAlloc >
stack_pool< TAlloc >::~stack_pool ( )
inline

Definition at line 69 of file stack_pool.h.

Member Function Documentation

◆ allocate()

template<typename TAlloc >
void stack_pool< TAlloc >::allocate ( stack_context ctx)
inline

allocate memory and attach to stack context [standard function]

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

Definition at line 117 of file stack_pool.h.

References COPP_LIKELY_IF.

◆ clear()

template<typename TAlloc >
void stack_pool< TAlloc >::clear ( )
inline

◆ create()

template<typename TAlloc >
static ptr_type stack_pool< TAlloc >::create ( )
inlinestatic

Definition at line 61 of file stack_pool.h.

◆ deallocate()

template<typename TAlloc >
void stack_pool< TAlloc >::deallocate ( stack_context ctx)
inline

deallocate memory from stack context [standard function]

Parameters
ctxstack context

Definition at line 183 of file stack_pool.h.

References COPP_LIKELY_IF.

◆ gc()

template<typename TAlloc >
size_t stack_pool< TAlloc >::gc ( )
inline

◆ get_gc_once_number()

template<typename TAlloc >
size_t stack_pool< TAlloc >::get_gc_once_number ( ) const
inline

Definition at line 107 of file stack_pool.h.

◆ get_limit()

template<typename TAlloc >
const limit_t& stack_pool< TAlloc >::get_limit ( ) const
inline

Definition at line 71 of file stack_pool.h.

◆ get_max_stack_number()

template<typename TAlloc >
size_t stack_pool< TAlloc >::get_max_stack_number ( ) const
inline

Definition at line 96 of file stack_pool.h.

◆ get_max_stack_size()

template<typename TAlloc >
size_t stack_pool< TAlloc >::get_max_stack_size ( ) const
inline

Definition at line 94 of file stack_pool.h.

◆ get_min_stack_number()

template<typename TAlloc >
size_t stack_pool< TAlloc >::get_min_stack_number ( ) const
inline

Definition at line 101 of file stack_pool.h.

◆ get_min_stack_size()

template<typename TAlloc >
size_t stack_pool< TAlloc >::get_min_stack_size ( ) const
inline

Definition at line 99 of file stack_pool.h.

◆ get_origin_allocator() [1/2]

template<typename TAlloc >
const allocator_type& stack_pool< TAlloc >::get_origin_allocator ( ) const
inline

Definition at line 75 of file stack_pool.h.

◆ get_origin_allocator() [2/2]

template<typename TAlloc >
allocator_type& stack_pool< TAlloc >::get_origin_allocator ( )
inline

Definition at line 74 of file stack_pool.h.

◆ get_stack_size()

template<typename TAlloc >
size_t stack_pool< TAlloc >::get_stack_size ( ) const
inline

Definition at line 90 of file stack_pool.h.

◆ get_stack_size_offset()

template<typename TAlloc >
size_t stack_pool< TAlloc >::get_stack_size_offset ( ) const
inline

Definition at line 91 of file stack_pool.h.

◆ is_auto_gc()

template<typename TAlloc >
bool stack_pool< TAlloc >::is_auto_gc ( ) const
inline

Definition at line 104 of file stack_pool.h.

◆ set_auto_gc()

template<typename TAlloc >
void stack_pool< TAlloc >::set_auto_gc ( bool  v)
inline

Definition at line 103 of file stack_pool.h.

◆ set_gc_once_number()

template<typename TAlloc >
void stack_pool< TAlloc >::set_gc_once_number ( size_t  v)
inline

Definition at line 106 of file stack_pool.h.

◆ set_max_stack_number()

template<typename TAlloc >
void stack_pool< TAlloc >::set_max_stack_number ( size_t  sz)
inline

Definition at line 95 of file stack_pool.h.

◆ set_max_stack_size()

template<typename TAlloc >
void stack_pool< TAlloc >::set_max_stack_size ( size_t  sz)
inline

Definition at line 93 of file stack_pool.h.

◆ set_min_stack_number()

template<typename TAlloc >
void stack_pool< TAlloc >::set_min_stack_number ( size_t  sz)
inline

Definition at line 100 of file stack_pool.h.

◆ set_min_stack_size()

template<typename TAlloc >
void stack_pool< TAlloc >::set_min_stack_size ( size_t  sz)
inline

Definition at line 98 of file stack_pool.h.

◆ set_stack_size()

template<typename TAlloc >
size_t stack_pool< TAlloc >::set_stack_size ( size_t  sz)
inline

Definition at line 77 of file stack_pool.h.

Field Documentation

◆ action_lock_

template<typename TAlloc >
LIBCOPP_COPP_NAMESPACE_ID::util::lock::spin_lock stack_pool< TAlloc >::action_lock_
private

Definition at line 313 of file stack_pool.h.

◆ alloc_

template<typename TAlloc >
allocator_type stack_pool< TAlloc >::alloc_
private

Definition at line 311 of file stack_pool.h.

◆ conf_

template<typename TAlloc >
configure_t stack_pool< TAlloc >::conf_
private

Definition at line 310 of file stack_pool.h.

◆ free_list_

template<typename TAlloc >
std::list<stack_context> stack_pool< TAlloc >::free_list_
private

Definition at line 315 of file stack_pool.h.

◆ limits_

template<typename TAlloc >
limit_t stack_pool< TAlloc >::limits_
private

Definition at line 309 of file stack_pool.h.


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