#include <pool.h>
Inherits ace::MemoryBlock< _Type >< _Type >.
Public Member Functions | |
| ContinuousMemoryBlock (size_t block_size, ContinuousMemoryBlock< _Type > *prev=NULL) | |
| Constructor creates new block and allocate desired memory for it. | |
| virtual | ~ContinuousMemoryBlock (void) throw () |
| Destructor unlinks current block from "continuous memory" and deletes assigned memory. | |
| _Type * | shift (const _Type *pointer, intptr_t offset) throw () |
| Returns `pointer` shifted by `offset`. | |
Private Member Functions | |
| ContinuousMemoryBlock< _Type > * | next (void) const throw () |
| ContinuousMemoryBlock< _Type > * | prev (void) const throw () |
| void | set_next (ContinuousMemoryBlock< _Type > *next) throw () |
| Sets next block in "continuous memory". | |
| void | set_prev (ContinuousMemoryBlock< _Type > *prev) throw () |
| Sets previous block in "continuous memory". | |
Private Attributes | |
| ContinuousMemoryBlock< _Type > * | _prev |
| Pointer to previous block in "continuous memory" (NULL for first block within pool). | |
| ContinuousMemoryBlock< _Type > * | _next |
| Pointer to next block in "continuous memory" (NULL for last block within pool). | |
The concept of "continuous memory" is simple. Particular blocks are linked together in double-linked list and for the outside world performs as one continuous piece of memory.
| _Type | Type to be stored within the block. |
Definition at line 127 of file pool.h.
| ace::ContinuousMemoryBlock< _Type >::ContinuousMemoryBlock | ( | size_t | block_size, | |
| ContinuousMemoryBlock< _Type > * | prev = NULL | |||
| ) | [inline] |
Constructor creates new block and allocate desired memory for it.
If predecessor block is given (`prev`), constructor automatically sets this block as `prev`'s successor.
| block_size | Size of newly allocated memory (in template type units). | |
| prev | Pointer to predecessor (default is NULL). |
| std::bad_alloc | When the memory for block cannot be allocated. |
| ContinuousMemoryBlock<_Type>* ace::ContinuousMemoryBlock< _Type >::next | ( | void | ) | const throw () [inline, private] |
| ContinuousMemoryBlock<_Type>* ace::ContinuousMemoryBlock< _Type >::prev | ( | void | ) | const throw () [inline, private] |
| void ace::ContinuousMemoryBlock< _Type >::set_next | ( | ContinuousMemoryBlock< _Type > * | next | ) | throw () [inline, private] |
| void ace::ContinuousMemoryBlock< _Type >::set_prev | ( | ContinuousMemoryBlock< _Type > * | prev | ) | throw () [inline, private] |
| _Type* ace::ContinuousMemoryBlock< _Type >::shift | ( | const _Type * | pointer, | |
| intptr_t | offset | |||
| ) | throw () [inline] |
Returns `pointer` shifted by `offset`.
The `pointer` must point at already transfered memory of current block, but the offset may shift the `pointer` to point to another block.
| pointer | Pointer which should be shifted. | |
| offset | Shift offset (in stored units). |
1.5.5