#include <pool.h>
Inherits ace::MemoryPool< _Type, _Block >< _Type, ace::ContinuousMemoryBlock< _Type > >.
Public Member Functions | |
| ContinuousPool (size_t block_size) throw () | |
| Constructor initializes the pool, but does not allocate any memory yet. | |
| virtual | ~ContinuousPool (void) throw () |
| Destructor frees all allocated memory by calling clear(). | |
| virtual void | clear (void) throw () |
| Frees all the allocated memory (deletes all memory pool blocks). | |
| virtual _Type * | get_memory (size_t) |
| _Type * | shift (const _Type *pointer, intptr_t offset) const throw () |
| Returns pointer to memory shifted by given offset (considered as stored units offset, not byte offset). | |
| _Type * | start (void) const throw () |
Protected Member Functions | |
| virtual ContinuousMemoryBlock < _Type > * | create_new_block (void) |
| Creates new memory block. | |
Private Types | |
|
typedef std::map< _Type *, ContinuousMemoryBlock < _Type > * > | _blocks_end_bounds_map |
| Type defining mapping memory block upper_bound to block itself (pointer to). | |
Private Attributes | |
| _blocks_end_bounds_map | _mem_blocks |
| Maps blocks upper bound values (addresses) to blocks themself. | |
| ContinuousMemoryBlock< _Type > * | _first |
| First pool block. | |
| ContinuousMemoryBlock< _Type > * | _recent |
| Recent pool block (the last one). | |
Due to this approach it's possible to shift between objects of same pool (see shift()).
| _Type | Type to be stored within the block. |
Definition at line 383 of file pool.h.
| ace::ContinuousPool< _Type >::ContinuousPool | ( | size_t | block_size | ) | throw () [inline] |
| virtual ContinuousMemoryBlock<_Type>* ace::ContinuousPool< _Type >::create_new_block | ( | void | ) | [inline, protected, virtual] |
Creates new memory block.
| std::bad_alloc | when there is not enough memory left to allocate new pool block. |
Implements ace::MemoryPool< _Type, _Block >.
| virtual void ace::ContinuousPool< _Type >::clear | ( | void | ) | throw () [inline, virtual] |
Frees all the allocated memory (deletes all memory pool blocks).
Use only when there is a guaranty that there are no pointers pointing at the memory pool left.
Implements ace::MemoryPool< _Type, _Block >.
| virtual _Type* ace::ContinuousPool< _Type >::get_memory | ( | size_t | ) | [inline, virtual] |
| std::bad_alloc | When there is no more memory available. |
Implements ace::MemoryPool< _Type, _Block >.
| _Type* ace::ContinuousPool< _Type >::shift | ( | const _Type * | pointer, | |
| intptr_t | offset | |||
| ) | const throw () [inline] |
Returns pointer to memory shifted by given offset (considered as stored units offset, not byte offset).
Note that: 1. Pointer must point somewhere into the "continuous memory" (call with invalid pointer is rejected even if after shifting the pointer will point to valid memory), otherwise NULL is returned. 2. If offset shifts the pointer behind the "continuous memory", NULL is returned.
| pointer | Pointer to the "continuous memory" from which apply the offset. | |
| offset | Shift offset (in stored units). |
| _Type* ace::ContinuousPool< _Type >::start | ( | void | ) | const throw () [inline] |
1.5.5