1#ifndef _RHEOLEF_HEAP_OBJECT_H
2#define _RHEOLEF_HEAP_OBJECT_H
24#include "rheolef/compiler.h"
41 mutable std::list<std::vector<char> >
_heap;
52 _heap_block_size(_heap_block_size_init),
53 _heap_block_last_free(0),
66 _heap_block_last_free = 0;
69 _heap.push_front(std::vector<char>(_heap_block_size*_sizeof_bucket));
76 if (_heap_block_last_free == _heap_block_size) {
77 _heap_block_size *= 2;
78 _heap.push_front(std::vector<char>(_heap_block_size*_sizeof_bucket));
79 _heap_block_last_free = 0;
81 std::vector<char>& block = *(_heap.begin());
82 char*
p = &block [_heap_block_last_free*_sizeof_bucket];
83 _heap_block_last_free++;
99 for (std::list<std::vector<char> >::reverse_iterator i = _heap.rbegin();
100 _counter != 0 && i != _heap.rend(); i++,
n *= 2) {
101 std::vector<char>& block = *i;
102 char*
p = &(block[0]);
103 for (
size_type c = 0; _counter != 0 &&
c <
n;
c++,
p += _sizeof_bucket) {
108 _heap.erase(_heap.begin(), _heap.end());
field::size_type size_type
std::list< std::vector< char > > _heap
heap_object(size_type sizeof_bucket=sizeof(T))
static const size_type _heap_block_size_init
void reinitialize(size_type sizeof_bucket=sizeof(T))
size_type _heap_block_last_free
size_type _heap_block_size
This file is part of Rheolef.