29#ifndef ALLOCATOR_INCLUDED
30#define ALLOCATOR_INCLUDED
53 std::vector<T*> memory;
56 blockSize=index=remains=0;
65 for(std::size_t i=0;i<memory.size();i++){
delete[] memory[i];}
67 blockSize=index=remains=0;
84 for(std::size_t i=0;i<memory.size();i++){
85 for(
int j=0;j<blockSize;j++){
87 new(&memory[i][j]) T();
100 if(
state.index<index){
101 for(
int j=
state.remains;j<blockSize;j++){
102 memory[
state.index][j].~T();
103 new(&memory[
state.index][j]) T();
105 for(
int i=
state.index+1;i<index-1;i++){
106 for(
int j=0;j<blockSize;j++){
108 new(&memory[i][j]) T();
111 for(
int j=0;j<remains;j++){
112 memory[index][j].~T();
113 new(&memory[index][j]) T();
116 remains=
state.remains;
119 for(
int j=0;j<
state.remains;j<remains){
120 memory[index][j].~T();
121 new(&memory[index][j]) T();
123 remains=
state.remains;
132 this->blockSize=blockSize;
150 if(index==memory.size()-1){
151 mem=
new T[blockSize];
153 memory.push_back(
mem);
158 mem=&(memory[index][blockSize-remains]);
Iterator class for point clouds with or without given indices.
This templated class assists in memory allocation and is well suited for instances when it is known t...
AllocatorState getState(void) const
This method returns the memory state of the allocator.
T * newElements(int elements=1)
This method returns a pointer to an array of elements objects.
void set(int blockSize)
This method initiallizes the constructor and the blockSize variable specifies the the number of objec...
void reset(void)
This method is the allocators destructor.
void rollBack(void)
This method rolls back the allocator so that it makes all of the memory previously allocated availabl...
void rollBack(const AllocatorState &state)
This method rolls back the allocator to the previous memory state and makes all of the memory previou...