#include <pool.h>
Public Member Functions | |
| MemoryBlock (size_t block_size) | |
| Constructor tries to allocate memory `block_size` units long. | |
| virtual | ~MemoryBlock (void) throw () |
| Destructor frees allocated memory. | |
| _Type * | assigned_mem_bound (void) const throw () |
| size_t | count_free_memory (void) const throw () |
| bool | is_full (void) const throw () |
| _Type * | get_memory (size_t mem_size=1) throw () |
| Returns pointer to the next `mem_size` units long chunk of memory and advances internal free memory pointer. | |
| _Type * | lower_bound (void) const throw () |
| _Type * | upper_bound (void) const throw () |
| size_t | unit_size (void) const throw () |
Protected Member Functions | |
| MemoryBlock (const MemoryBlock< _Type > &mpb) | |
| No copy constructs. | |
| MemoryBlock< _Type > & | operator= (const MemoryBlock< _Type > &mpb) |
| No assignments. | |
Private Attributes | |
| const size_t | _unit_size |
| Stored unit size (sizeof(_Type) result). | |
| _Type * | _memory |
| Pointers to the start of the block Following must be always true: _memory <= _free <= _upper_bound. | |
| _Type * | _free |
| Pointer to the beginning of free memory. | |
| _Type * | _upper_bound |
| Pointers to the first address behind block memory. | |
| _Type | Type to be stored within the block. |
| ace::MemoryBlock< _Type >::MemoryBlock | ( | const MemoryBlock< _Type > & | mpb | ) | [protected] |
No copy constructs.
| ace::MemoryBlock< _Type >::MemoryBlock | ( | size_t | block_size | ) | [inline] |
Constructor tries to allocate memory `block_size` units long.
If allocation succeeds both `_start` and `_free` point to the newly allocated memory, otherwise std::bad_alloc is throwed.
| block_size | Size of newly allocated memory (in template type units). |
| std::bad_alloc | When the memory for block cannot be allocated. |
| virtual ace::MemoryBlock< _Type >::~MemoryBlock | ( | void | ) | throw () [inline, virtual] |
Destructor frees allocated memory.
| MemoryBlock<_Type>& ace::MemoryBlock< _Type >::operator= | ( | const MemoryBlock< _Type > & | mpb | ) | [protected] |
No assignments.
| _Type* ace::MemoryBlock< _Type >::assigned_mem_bound | ( | void | ) | const throw () [inline] |
| size_t ace::MemoryBlock< _Type >::count_free_memory | ( | void | ) | const throw () [inline] |
| bool ace::MemoryBlock< _Type >::is_full | ( | void | ) | const throw () [inline] |
| _Type* ace::MemoryBlock< _Type >::get_memory | ( | size_t | mem_size = 1 |
) | throw () [inline] |
Returns pointer to the next `mem_size` units long chunk of memory and advances internal free memory pointer.
In case there is not enough of memory in the pool NULL is returned.
| mem_size | Size of demanded memory (in units stored, not in bytes!). |
| _Type* ace::MemoryBlock< _Type >::lower_bound | ( | void | ) | const throw () [inline] |
| _Type* ace::MemoryBlock< _Type >::upper_bound | ( | void | ) | const throw () [inline] |
| size_t ace::MemoryBlock< _Type >::unit_size | ( | void | ) | const throw () [inline] |
const size_t ace::MemoryBlock< _Type >::_unit_size [private] |
Stored unit size (sizeof(_Type) result).
_Type* ace::MemoryBlock< _Type >::_memory [private] |
Pointers to the start of the block Following must be always true: _memory <= _free <= _upper_bound.
_Type* ace::MemoryBlock< _Type >::_free [private] |
Pointer to the beginning of free memory.
Following must be always true: _memory <= _free <= _upper_bound.
_Type* ace::MemoryBlock< _Type >::_upper_bound [private] |
Pointers to the first address behind block memory.
Following must be always true: _memory <= _free <= _upper_bound.
1.5.6