libcopp  1.2.1
Public Member Functions | Private Attributes
copp::allocator::stack_allocator_memory Class Reference

memory allocator this allocator will return address of specified memory section More...

#include <stack_allocator_memory.h>

Collaboration diagram for copp::allocator::stack_allocator_memory:
Collaboration graph

Public Member Functions

 stack_allocator_memory () UTIL_CONFIG_NOEXCEPT
 
 stack_allocator_memory (void *start_ptr, std::size_t max_size) UTIL_CONFIG_NOEXCEPT
 
 stack_allocator_memory (stack_allocator_memory &other) UTIL_CONFIG_NOEXCEPT
 
 ~stack_allocator_memory ()
 
stack_allocator_memoryoperator= (stack_allocator_memory &other) UTIL_CONFIG_NOEXCEPT
 
void swap (stack_allocator_memory &other)
 
void attach (void *start_ptr, std::size_t max_size) UTIL_CONFIG_NOEXCEPT
 
void allocate (stack_context &ctx, std::size_t size) UTIL_CONFIG_NOEXCEPT
 
void deallocate (stack_context &ctx) UTIL_CONFIG_NOEXCEPT
 

Private Attributes

void * start_ptr_
 
std::size_t memory_size_
 
bool is_used_
 

Detailed Description

memory allocator this allocator will return address of specified memory section

Definition at line 23 of file stack_allocator_memory.h.

Constructor & Destructor Documentation

copp::allocator::stack_allocator_memory::stack_allocator_memory ( )

Definition at line 26 of file stack_allocator_memory.cpp.

Referenced by stack_allocator_memory().

copp::allocator::stack_allocator_memory::stack_allocator_memory ( void *  start_ptr,
std::size_t  max_size 
)

construct and attach to start_ptr with size of max_size

Parameters
start_ptrbuffer start address
max_sizebuffer size

Definition at line 30 of file stack_allocator_memory.cpp.

copp::allocator::stack_allocator_memory::stack_allocator_memory ( stack_allocator_memory other)
copp::allocator::stack_allocator_memory::~stack_allocator_memory ( )

Definition at line 54 of file stack_allocator_memory.cpp.

Member Function Documentation

void copp::allocator::stack_allocator_memory::allocate ( stack_context ctx,
std::size_t  size 
)

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 84 of file stack_allocator_memory.cpp.

References is_used_, copp::stack_traits::maximum_size(), memory_size_, copp::stack_traits::minimum_size(), copp::stack_traits::round_to_page_size(), and start_ptr_.

Referenced by CASE_TEST().

void copp::allocator::stack_allocator_memory::attach ( void *  start_ptr,
std::size_t  max_size 
)

specify memory section allocated

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

Definition at line 78 of file stack_allocator_memory.cpp.

References is_used_, memory_size_, and start_ptr_.

Referenced by CASE_TEST().

void copp::allocator::stack_allocator_memory::deallocate ( stack_context ctx)

deallocate memory from stack context [standard function]

Parameters
ctxstack context

Definition at line 106 of file stack_allocator_memory.cpp.

References copp::stack_traits::is_unbounded(), is_used_, copp::stack_traits::maximum_size(), and copp::stack_traits::minimum_size().

stack_allocator_memory & copp::allocator::stack_allocator_memory::operator= ( stack_allocator_memory other)

Definition at line 56 of file stack_allocator_memory.cpp.

References swap().

void copp::allocator::stack_allocator_memory::swap ( stack_allocator_memory other)

Definition at line 71 of file stack_allocator_memory.cpp.

References is_used_, memory_size_, and start_ptr_.

Referenced by operator=(), and stack_allocator_memory().

Field Documentation

bool copp::allocator::stack_allocator_memory::is_used_
private

Definition at line 27 of file stack_allocator_memory.h.

Referenced by allocate(), attach(), deallocate(), stack_allocator_memory(), and swap().

std::size_t copp::allocator::stack_allocator_memory::memory_size_
private

Definition at line 26 of file stack_allocator_memory.h.

Referenced by allocate(), attach(), stack_allocator_memory(), and swap().

void* copp::allocator::stack_allocator_memory::start_ptr_
private

Definition at line 25 of file stack_allocator_memory.h.

Referenced by allocate(), attach(), stack_allocator_memory(), and swap().


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