dune-common  2.3.1
Classes | Enumerations | Functions
Allocators

Classes

struct  Dune::DebugAllocator< T >::rebind< U >
 
class  Dune::DebugAllocator< T >
 Allocators implementation which performs different kind of memory checks. More...
 
struct  Dune::MallocAllocator< T >::rebind< U >
 
class  Dune::MallocAllocator< T >
 Allocators implementation which simply calls malloc/free. More...
 
class  Dune::Pool< T, s >
 A memory pool of objects. More...
 
struct  Dune::PoolAllocator< T, s >::rebind< U >
 Rebind the allocator to another type. More...
 
class  Dune::PoolAllocator< T, s >
 An allocator managing a pool of objects for reuse. More...
 
struct  Dune::PoolAllocator< void, s >::rebind< U >
 
class  Dune::PoolAllocator< void, s >
 

Enumerations

enum  {
  Dune::Pool< T, s >::unionSize, Dune::Pool< T, s >::size, Dune::Pool< T, s >::alignment = Lcm<AlignmentOf<MemberType>::value,AlignmentOf<Reference>::value>::value, Dune::Pool< T, s >::alignedSize,
  Dune::Pool< T, s >::chunkSize, Dune::Pool< T, s >::elements = ((chunkSize - alignment + 1)/ alignedSize)
}
 
enum  { Dune::PoolAllocator< T, s >::size =s*sizeof(value_type) }
 

Functions

template<typename T1 , std::size_t t1, typename T2 , std::size_t t2>
bool Dune::operator== (const PoolAllocator< T1, t1 > &, const PoolAllocator< T2, t2 > &)
 
template<typename T1 , std::size_t t1, typename T2 , std::size_t t2>
bool Dune::operator!= (const PoolAllocator< T1, t1 > &, const PoolAllocator< T2, t2 > &)
 
template<typename T , std::size_t t1, std::size_t t2>
bool Dune::operator== (const PoolAllocator< T, t1 > &p1, const PoolAllocator< T, t2 > &p2)
 
template<typename T , std::size_t t1, std::size_t t2>
bool Dune::operator!= (const PoolAllocator< T, t1 > &p1, const PoolAllocator< T, t2 > &p2)
 
template<typename T , std::size_t t1, std::size_t t2>
bool Dune::operator== (const PoolAllocator< void, t1 > &, const PoolAllocator< T, t2 > &)
 
template<typename T , std::size_t t1, std::size_t t2>
bool Dune::operator!= (const PoolAllocator< void, t1 > &, const PoolAllocator< T, t2 > &)
 
template<std::size_t t1, std::size_t t2>
bool Dune::operator== (const PoolAllocator< void, t1 > &p1, const PoolAllocator< void, t2 > &p2)
 
template<std::size_t t1, std::size_t t2>
bool Dune::operator!= (const PoolAllocator< void, t1 > &p1, const PoolAllocator< void, t2 > &p2)
 
 Dune::Pool< T, s >::Pool ()
 Constructor. More...
 
 Dune::Pool< T, s >::~Pool ()
 Destructor. More...
 
void Dune::Pool< T, s >::print (std::ostream &os)
 Print elements in pool for debugging. More...
 
void Dune::Pool< T, s >::free (void *o)
 Free an object. More...
 
void * Dune::Pool< T, s >::allocate ()
 Get a new or recycled object. More...
 
 Dune::PoolAllocator< T, s >::PoolAllocator ()
 Constructor. More...
 
pointer Dune::PoolAllocator< T, s >::allocate (std::size_t n, const_pointer hint=0)
 Allocates objects. More...
 
void Dune::PoolAllocator< T, s >::deallocate (pointer p, std::size_t n)
 Free objects. More...
 
void Dune::PoolAllocator< T, s >::construct (pointer p, const_reference value)
 Construct an object. More...
 
void Dune::PoolAllocator< T, s >::destroy (pointer p)
 Destroy an object without freeing memory. More...
 

Detailed Description

Enumeration Type Documentation

template<class T, std::size_t s>
anonymous enum
Enumerator
unionSize 

The size of a union of Reference and MemberType.

size 

Size requirement. At least one object has to stored.

alignment 

The alignment that suits both the MemberType and the Reference (i.e. their least common multiple).

alignedSize 

The aligned size of the type.

This size is bigger than sizeof of the type and a multiple of the alignment requirement.

chunkSize 

The size of each chunk memory chunk.

Will be adapted to be a multiple of the alignment plus an offset to handle the case that the pointer to the memory does not satisfy the alignment requirements.

elements 

The number of element each chunk can hold.

template<class T, std::size_t s>
anonymous enum
Enumerator
size 

The number of objects to fit into one memory chunk allocated.

Function Documentation

template<class T , std::size_t S>
void * Dune::Pool< T, S >::allocate ( )
inline

Get a new or recycled object.

Returns
A pointer to the object memory.
template<class T , std::size_t s>
PoolAllocator< T, s >::pointer Dune::PoolAllocator< T, s >::allocate ( std::size_t  n,
const_pointer  hint = 0 
)
inline

Allocates objects.

Parameters
nThe number of objects to allocate. Has to be one!
hintIgnored hint.
Returns
A pointer tp the allocated elements.
template<class T , std::size_t s>
void Dune::PoolAllocator< T, s >::construct ( pointer  p,
const_reference  value 
)
inline

Construct an object.

Parameters
pPointer to the object.
valueThe value to initialize it to.
template<class T , std::size_t s>
void Dune::PoolAllocator< T, s >::deallocate ( pointer  p,
std::size_t  n 
)
inline

Free objects.

Does not call the destructor!

Parameters
nThe number of objects to free. Has to be one!
pPointer to the first object.
template<class T , std::size_t s>
void Dune::PoolAllocator< T, s >::destroy ( pointer  p)
inline

Destroy an object without freeing memory.

Parameters
pPointer to the object.
template<class T , std::size_t S>
void Dune::Pool< T, S >::free ( void *  o)
inline

Free an object.

Parameters
oThe pointer to memory block of the object.
template<typename T1 , std::size_t t1, typename T2 , std::size_t t2>
bool Dune::operator!= ( const PoolAllocator< T1, t1 > &  ,
const PoolAllocator< T2, t2 > &   
)
template<typename T , std::size_t t1, std::size_t t2>
bool Dune::operator!= ( const PoolAllocator< T, t1 > &  p1,
const PoolAllocator< T, t2 > &  p2 
)
template<typename T , std::size_t t1, std::size_t t2>
bool Dune::operator!= ( const PoolAllocator< void, t1 > &  ,
const PoolAllocator< T, t2 > &   
)
template<std::size_t t1, std::size_t t2>
bool Dune::operator!= ( const PoolAllocator< void, t1 > &  p1,
const PoolAllocator< void, t2 > &  p2 
)
template<typename T1 , std::size_t t1, typename T2 , std::size_t t2>
bool Dune::operator== ( const PoolAllocator< T1, t1 > &  ,
const PoolAllocator< T2, t2 > &   
)
template<typename T , std::size_t t1, std::size_t t2>
bool Dune::operator== ( const PoolAllocator< T, t1 > &  p1,
const PoolAllocator< T, t2 > &  p2 
)
template<typename T , std::size_t t1, std::size_t t2>
bool Dune::operator== ( const PoolAllocator< void, t1 > &  ,
const PoolAllocator< T, t2 > &   
)
template<std::size_t t1, std::size_t t2>
bool Dune::operator== ( const PoolAllocator< void, t1 > &  p1,
const PoolAllocator< void, t2 > &  p2 
)
template<class T , std::size_t S>
Dune::Pool< T, S >::Pool ( )
inline
template<class T , std::size_t s>
Dune::PoolAllocator< T, s >::PoolAllocator ( )
inline

Constructor.

template<class T , std::size_t S>
void Dune::Pool< T, S >::print ( std::ostream &  os)
inline

Print elements in pool for debugging.

template<class T , std::size_t S>
Dune::Pool< T, S >::~Pool ( )
inline

Destructor.