ATLAS Offline Software
Loading...
Searching...
No Matches
SG::ArenaNonConstPoolSTLAllocator< T > Class Template Reference

Forward declaration. More...

#include <ArenaPoolSTLAllocator.h>

Inheritance diagram for SG::ArenaNonConstPoolSTLAllocator< T >:
Collaboration diagram for SG::ArenaNonConstPoolSTLAllocator< T >:

Public Types

typedef T * pointer
 Standard STL allocator typedefs.
typedef const T * const_pointer
typedef T & reference
typedef const T & const_reference
typedef T value_type
typedef size_t size_type
typedef ptrdiff_t difference_type
typedef std::false_type propagate_on_container_copy_assignment
 When we assign to a container, the target should retain its allocator.
typedef std::true_type propagate_on_container_move_assignment
 Move allocators on move/swap.
typedef std::true_type propagate_on_container_swap

Public Member Functions

template<class U, class V>
 ArenaNonConstPoolSTLAllocator (const ArenaPoolSTLAllocator< U, V > &a, ArenaBlockAllocatorBase *poolptr_nc)
 Constructor.
void reset ()
 Free all allocated elements.
void erase ()
 Free all allocated elements and release memory back to the system.
void reserve (size_t size)
 Set the total number of elements cached by the allocator.
void protect ()
 Write-protect the memory managed by this allocator.
void unprotect ()
 Write-enable the memory managed by this allocator.
void swap (ArenaPoolSTLAllocator &a)
 Swap.
ArenaPoolSTLAllocator select_on_container_copy_construction () const
 Return allocator to use for a copy-constructed container.
bool operator== (const ArenaPoolSTLAllocator &other) const
 Equality test.
bool operator!= (const ArenaPoolSTLAllocator &other) const
 Inequality test.
pointer address (reference x) const
 Convert a reference to an address.
pointer allocate (size_type n, const void *hint=0)
 Allocate new objects.
void deallocate (pointer, size_type n)
 Deallocate objects.
size_type max_size () const throw ()
 Return the maximum number of objects we can allocate at once.
void construct (pointer p, Args &&... args)
 Call the T constructor.
void destroy (pointer p)
 Call the T destructor.
size_t nblock () const
 Return the hinted number of objects allocated per block.
const std::string & name () const
 Return the name of this allocator.
ArenaAllocatorBase::Stats stats () const
 Return the statistics block for this allocator.
const ArenaBlockAllocatorBasepoolptr () const
 Return a pointer to the underlying allocator (may be 0).

Private Attributes

ArenaBlockAllocatorBasem_poolptr_nc
 Non-const pointer to the underlying allocator.
ArenaPoolAllocator m_pool
 The underlying allocator.

Detailed Description

template<class T>
class SG::ArenaNonConstPoolSTLAllocator< T >

Forward declaration.

STL-style allocator wrapper for ArenaPoolAllocator.

Non-const variant for the case of the vetoed type.

See documentation above for details.

Definition at line 542 of file ArenaPoolSTLAllocator.h.

Member Typedef Documentation

◆ const_pointer

typedef const T* SG::ArenaPoolSTLAllocator< T, T >::const_pointer
inherited

Definition at line 110 of file ArenaPoolSTLAllocator.h.

◆ const_reference

typedef const T& SG::ArenaPoolSTLAllocator< T, T >::const_reference
inherited

Definition at line 112 of file ArenaPoolSTLAllocator.h.

◆ difference_type

typedef ptrdiff_t SG::ArenaPoolSTLAllocator< T, T >::difference_type
inherited

Definition at line 115 of file ArenaPoolSTLAllocator.h.

◆ pointer

typedef T* SG::ArenaPoolSTLAllocator< T, T >::pointer
inherited

Standard STL allocator typedefs.

Definition at line 109 of file ArenaPoolSTLAllocator.h.

◆ propagate_on_container_copy_assignment

typedef std::false_type SG::ArenaPoolSTLAllocator< T, T >::propagate_on_container_copy_assignment
inherited

When we assign to a container, the target should retain its allocator.

Definition at line 118 of file ArenaPoolSTLAllocator.h.

◆ propagate_on_container_move_assignment

typedef std::true_type SG::ArenaPoolSTLAllocator< T, T >::propagate_on_container_move_assignment
inherited

Move allocators on move/swap.

Definition at line 121 of file ArenaPoolSTLAllocator.h.

◆ propagate_on_container_swap

typedef std::true_type SG::ArenaPoolSTLAllocator< T, T >::propagate_on_container_swap
inherited

Definition at line 122 of file ArenaPoolSTLAllocator.h.

◆ reference

typedef T& SG::ArenaPoolSTLAllocator< T, T >::reference
inherited

Definition at line 111 of file ArenaPoolSTLAllocator.h.

◆ size_type

typedef size_t SG::ArenaPoolSTLAllocator< T, T >::size_type
inherited

Definition at line 114 of file ArenaPoolSTLAllocator.h.

◆ value_type

typedef T SG::ArenaPoolSTLAllocator< T, T >::value_type
inherited

Definition at line 113 of file ArenaPoolSTLAllocator.h.

Constructor & Destructor Documentation

◆ ArenaNonConstPoolSTLAllocator()

template<class T>
template<class U, class V>
SG::ArenaNonConstPoolSTLAllocator< T >::ArenaNonConstPoolSTLAllocator ( const ArenaPoolSTLAllocator< U, V > & a,
ArenaBlockAllocatorBase * poolptr_nc )

Constructor.

Parameters
aAllocator to reference.
poolptr_ncNon-const pointer to the underlying allocator.

Member Function Documentation

◆ address()

pointer SG::ArenaPoolSTLAllocator< T, T >::address ( reference x) const
inherited

Convert a reference to an address.

◆ allocate()

pointer SG::ArenaPoolSTLAllocator< T, T >::allocate ( size_type n,
const void * hint = 0 )
inherited

Allocate new objects.

Parameters
nNumber of objects to allocate. Must be 1.
hintAllocation hint. Not used.

◆ construct()

void SG::ArenaPoolSTLAllocator< T, T >::construct ( pointer p,
Args &&... args )
inherited

Call the T constructor.

Parameters
pLocation of the memory.
argsArguments to pass to the constructor.

◆ deallocate()

void SG::ArenaPoolSTLAllocator< T, T >::deallocate ( pointer ,
size_type n )
inherited

Deallocate objects.

Parameters
nNumber of objects to deallocate. Must be 1.

This implementation doesn't do anything.

◆ destroy()

void SG::ArenaPoolSTLAllocator< T, T >::destroy ( pointer p)
inherited

Call the T destructor.

Parameters
pLocation of the memory.

◆ erase()

template<class T>
void SG::ArenaNonConstPoolSTLAllocator< T >::erase ( )

Free all allocated elements and release memory back to the system.

All elements allocated are freed, and all allocated blocks of memory are released back to the system. destructor should be called on them if it was provided (preceded by clear if provided and mustClear was set).

◆ max_size()

size_type SG::ArenaPoolSTLAllocator< T, T >::max_size ( ) const
throw ( )
inherited

Return the maximum number of objects we can allocate at once.

This always returns 1.

◆ name()

const std::string & SG::ArenaPoolSTLAllocator< T, T >::name ( ) const
inherited

Return the name of this allocator.

◆ nblock()

size_t SG::ArenaPoolSTLAllocator< T, T >::nblock ( ) const
inherited

Return the hinted number of objects allocated per block.

◆ operator!=()

bool SG::ArenaPoolSTLAllocator< T, T >::operator!= ( const ArenaPoolSTLAllocator< T, T > & other) const
inherited

Inequality test.

Two allocators should compare equal if objects allocated by one can be deallocated by the other. We should just check if they are the same object.

◆ operator==()

bool SG::ArenaPoolSTLAllocator< T, T >::operator== ( const ArenaPoolSTLAllocator< T, T > & other) const
inherited

Equality test.

Two allocators should compare equal if objects allocated by one can be deallocated by the other. We should just check if they are the same object.

◆ poolptr()

const ArenaBlockAllocatorBase * SG::ArenaPoolSTLAllocator< T, T >::poolptr ( ) const
inherited

Return a pointer to the underlying allocator (may be 0).

◆ protect()

template<class T>
void SG::ArenaNonConstPoolSTLAllocator< T >::protect ( )

Write-protect the memory managed by this allocator.

Adjust protection on the memory managed by this allocator to disallow writes.

◆ reserve()

template<class T>
void SG::ArenaNonConstPoolSTLAllocator< T >::reserve ( size_t size)

Set the total number of elements cached by the allocator.

Parameters
sizeThe desired pool size.

This allows changing the number of elements that are currently free but cached. Any allocated elements are not affected by this call.

If size is greater than the total number of elements currently cached, then more will be allocated. This will preferably done with a single block, but that is not guaranteed; in addition, the allocator may allocate more elements than is requested.

If size is smaller than the total number of elements currently cached, as many blocks as possible will be released back to the system. It may not be possible to release the number of elements requested; this should be implemented on a best-effort basis.

◆ reset()

template<class T>
void SG::ArenaNonConstPoolSTLAllocator< T >::reset ( )

Free all allocated elements.

All elements allocated are returned to the free state. clear should be called on them if it was provided. The elements may continue to be cached internally, without returning to the system.

◆ select_on_container_copy_construction()

ArenaPoolSTLAllocator SG::ArenaPoolSTLAllocator< T, T >::select_on_container_copy_construction ( ) const
inherited

Return allocator to use for a copy-constructed container.

When we copy-construct a container, we want the new allocator to copy parameters from the old one, but not the data.

◆ stats()

ArenaAllocatorBase::Stats SG::ArenaPoolSTLAllocator< T, T >::stats ( ) const
inherited

Return the statistics block for this allocator.

◆ swap()

void SG::ArenaPoolSTLAllocator< T, T >::swap ( ArenaPoolSTLAllocator< T, T > & a)
inherited

Swap.

◆ unprotect()

template<class T>
void SG::ArenaNonConstPoolSTLAllocator< T >::unprotect ( )

Write-enable the memory managed by this allocator.

Adjust protection on the memory managed by this allocator to allow writes.

Member Data Documentation

◆ m_pool

ArenaPoolAllocator SG::ArenaPoolSTLAllocator< T, T >::m_pool
privateinherited

The underlying allocator.

Definition at line 349 of file ArenaPoolSTLAllocator.h.

◆ m_poolptr_nc

template<class T>
ArenaBlockAllocatorBase* SG::ArenaNonConstPoolSTLAllocator< T >::m_poolptr_nc
private

Non-const pointer to the underlying allocator.

Definition at line 618 of file ArenaPoolSTLAllocator.h.


The documentation for this class was generated from the following file: