Dune Core Modules (2.3.1)
poolallocator.hh
Go to the documentation of this file.
155 };
265 };
461 dune_static_assert(sizeof(T)<=chunkSize, "Library Error: chunkSize must be able to hold at least one value");
462 dune_static_assert(sizeof(Reference)<=chunkSize, "Library Error: chunkSize must be able to hold at least one reference");
463 dune_static_assert((chunkSize - (alignment - 1)) % alignment == 0, "Library Error: compiler cannot calculate!");
465 dune_static_assert(elements*alignedSize<=chunkSize, "Library Error: aligned elements must fit into chuck!");
473 std::cerr<<"There are still "<<allocated_<<" allocated elements by the Pool<"<<typeid(T).name()<<","<<S<<"> "
This file implements a template class to determine alignment requirements of types at compile time.
An allocator managing a pool of objects for reuse.
Definition: poolallocator.hh:249
Pool< T, size > PoolType
The type of the memory pool we use.
Definition: poolallocator.hh:378
const_pointer address(const_reference x) const
Convert a reference to a pointer.
Definition: poolallocator.hh:361
int max_size() const
Not correctly implemented, yet!
Definition: poolallocator.hh:366
const T & const_reference
The constant reference type.
Definition: poolallocator.hh:285
T value_type
Type of the values we construct and allocate.
Definition: poolallocator.hh:256
@ size
The number of objects to fit into one memory chunk allocated.
Definition: poolallocator.hh:264
PoolAllocator(const PoolAllocator &)
Copy constructor that does not copy the memory pool.
Definition: poolallocator.hh:313
const T * const_pointer
The constant pointer type.
Definition: poolallocator.hh:275
pointer address(reference x) const
Convert a reference to a pointer.
Definition: poolallocator.hh:355
PoolAllocator(const PoolAllocator< U, u > &)
Copy Constructor that does not copy the memory pool.
Definition: poolallocator.hh:306
std::ptrdiff_t difference_type
The difference_type.
Definition: poolallocator.hh:295
@ elements
The number of element each chunk can hold.
Definition: poolallocator.hh:154
@ chunkSize
The size of each chunk memory chunk.
Definition: poolallocator.hh:147
@ unionSize
The size of a union of Reference and MemberType.
Definition: poolallocator.hh:114
@ alignment
The alignment that suits both the MemberType and the Reference (i.e. their least common multiple).
Definition: poolallocator.hh:128
@ size
Size requirement. At least one object has to stored.
Definition: poolallocator.hh:121
T MemberType
The type of object we allocate memory for.
Definition: poolallocator.hh:108
void construct(pointer p, const_reference value)
Construct an object.
Definition: poolallocator.hh:584
void print(std::ostream &os)
Print elements in pool for debugging.
Definition: poolallocator.hh:489
pointer allocate(std::size_t n, const_pointer hint=0)
Allocates objects.
Definition: poolallocator.hh:568
void deallocate(pointer p, std::size_t n)
Free objects.
Definition: poolallocator.hh:577
void destroy(pointer p)
Destroy an object without freeing memory.
Definition: poolallocator.hh:590
#define dune_static_assert(COND, MSG)
Helper template so that compilation fails if condition is not true.
Definition: static_assert.hh:79
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:231
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:253
Statically compute the least common multiple of two integers.
STL namespace.
Fallback implementation of the C++0x static_assert feature.
Get the 'const' version of a reference to a mutable object.
Definition: genericiterator.hh:86
|
Legal Statements / Impressum |
Hosted by TU Dresden |
generated with Hugo v0.111.3
(Nov 12, 23:30, 2024)