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

Forward declaration. More...

#include <ArenaHeapSTLAllocator.h>

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

Public Types

typedef std::allocator< T > base
typedef base::value_type value_type
 Standard STL allocator typedefs.
typedef base::size_type size_type
typedef base::difference_type difference_type
typedef T * pointer
 Standard STL allocator typedefs.
typedef const T * const_pointer
typedef T & reference
typedef const T & const_reference
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>
 ArenaNonConstHeapSTLAllocator (const ArenaHeapSTLAllocator< 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.
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).
void swap (ArenaHeapSTLAllocator &a)
 Swap.
ArenaHeapSTLAllocator select_on_container_copy_construction () const
 Return allocator to use for a copy-constructed container.
bool operator== (const ArenaHeapSTLAllocator &other) const
 Equality test.
bool operator!= (const ArenaHeapSTLAllocator &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.

Static Public Member Functions

template<class CONT>
static ArenaNonConstHeapSTLAllocator< T > get_allocator (CONT &c)
 Return an allocator supporting non-const methods from a non-const container reference.

Public Attributes

elements
 STL member.

Private Attributes

ArenaBlockAllocatorBasem_poolptr_nc
 Non-const pointer to the underlying allocator.
size_t m_nblock
 Saved hinted number of objects per block.
std::string m_name
 Saved allocator name.
const ArenaBlockAllocatorBasem_poolptr
 Point at an underlying allocator from a different specialization.
ArenaHeapAllocator m_pool
 The underlying allocator.

Detailed Description

template<class T>
class SG::ArenaNonConstHeapSTLAllocator< T >

Forward declaration.

STL-style allocator wrapper for ArenaHeapAllocator.

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

See documentation above for details.

Definition at line 466 of file ArenaHeapSTLAllocator.h.

Member Typedef Documentation

◆ base

template<class T>
typedef std::allocator<T> SG::ArenaHeapSTLAllocator< T, T >::base
inherited

Definition at line 376 of file ArenaHeapSTLAllocator.h.

◆ const_pointer

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

Definition at line 98 of file ArenaHeapSTLAllocator.h.

◆ const_reference

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

Definition at line 100 of file ArenaHeapSTLAllocator.h.

◆ difference_type

template<class T>
typedef base::difference_type SG::ArenaHeapSTLAllocator< T, T >::difference_type
inherited

Definition at line 381 of file ArenaHeapSTLAllocator.h.

◆ pointer

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

Standard STL allocator typedefs.

Definition at line 97 of file ArenaHeapSTLAllocator.h.

◆ propagate_on_container_copy_assignment

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

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

Definition at line 106 of file ArenaHeapSTLAllocator.h.

◆ propagate_on_container_move_assignment

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

Move allocators on move/swap.

Definition at line 109 of file ArenaHeapSTLAllocator.h.

◆ propagate_on_container_swap

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

Definition at line 110 of file ArenaHeapSTLAllocator.h.

◆ reference

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

Definition at line 99 of file ArenaHeapSTLAllocator.h.

◆ size_type

template<class T>
typedef base::size_type SG::ArenaHeapSTLAllocator< T, T >::size_type
inherited

Definition at line 380 of file ArenaHeapSTLAllocator.h.

◆ value_type

template<class T>
typedef base::value_type SG::ArenaHeapSTLAllocator< T, T >::value_type
inherited

Standard STL allocator typedefs.

Definition at line 379 of file ArenaHeapSTLAllocator.h.

Constructor & Destructor Documentation

◆ ArenaNonConstHeapSTLAllocator()

template<class T>
template<class U, class V>
SG::ArenaNonConstHeapSTLAllocator< T >::ArenaNonConstHeapSTLAllocator ( const ArenaHeapSTLAllocator< 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::ArenaHeapSTLAllocator< T, T >::address ( reference x) const
inherited

Convert a reference to an address.

◆ allocate()

pointer SG::ArenaHeapSTLAllocator< 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::ArenaHeapSTLAllocator< 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::ArenaHeapSTLAllocator< T, T >::deallocate ( pointer ,
size_type n )
inherited

Deallocate objects.

Parameters
nNumber of objects to deallocate. Must be 1.

◆ destroy()

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

Call the T destructor.

Parameters
pLocation of the memory.

◆ erase()

template<class T>
void SG::ArenaNonConstHeapSTLAllocator< 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).

◆ get_allocator()

template<class T>
template<class CONT>
ArenaNonConstHeapSTLAllocator< T > SG::ArenaHeapSTLAllocator< T, T >::get_allocator ( CONT & c)
staticinherited

Return an allocator supporting non-const methods from a non-const container reference.

Parameters
cThe (non-const) container.

◆ max_size()

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

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

This always returns 1.

◆ name()

template<class T>
const std::string & SG::ArenaHeapSTLAllocator< T, T >::name ( ) const
inherited

Return the name of this allocator.

◆ nblock()

template<class T>
size_t SG::ArenaHeapSTLAllocator< T, T >::nblock ( ) const
inherited

Return the hinted number of objects allocated per block.

◆ operator!=()

bool SG::ArenaHeapSTLAllocator< T, T >::operator!= ( const ArenaHeapSTLAllocator< 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::ArenaHeapSTLAllocator< T, T >::operator== ( const ArenaHeapSTLAllocator< 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()

template<class T>
const ArenaBlockAllocatorBase * SG::ArenaHeapSTLAllocator< T, T >::poolptr ( ) const
inherited

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

◆ protect()

template<class T>
void SG::ArenaNonConstHeapSTLAllocator< 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::ArenaNonConstHeapSTLAllocator< 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::ArenaNonConstHeapSTLAllocator< 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()

ArenaHeapSTLAllocator SG::ArenaHeapSTLAllocator< 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()

template<class T>
ArenaAllocatorBase::Stats SG::ArenaHeapSTLAllocator< T, T >::stats ( ) const
inherited

Return the statistics block for this allocator.

◆ swap()

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

Swap.

◆ unprotect()

template<class T>
void SG::ArenaNonConstHeapSTLAllocator< 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

◆ elements

T std::allocator< T >::elements
inherited

STL member.

◆ m_name

template<class T>
std::string SG::ArenaHeapSTLAllocator< T, T >::m_name
privateinherited

Saved allocator name.

Definition at line 452 of file ArenaHeapSTLAllocator.h.

◆ m_nblock

template<class T>
size_t SG::ArenaHeapSTLAllocator< T, T >::m_nblock
privateinherited

Saved hinted number of objects per block.

Definition at line 449 of file ArenaHeapSTLAllocator.h.

◆ m_pool

ArenaHeapAllocator SG::ArenaHeapSTLAllocator< T, T >::m_pool
privateinherited

The underlying allocator.

Definition at line 342 of file ArenaHeapSTLAllocator.h.

◆ m_poolptr

template<class T>
const ArenaBlockAllocatorBase* SG::ArenaHeapSTLAllocator< T, T >::m_poolptr
privateinherited

Point at an underlying allocator from a different specialization.

Definition at line 455 of file ArenaHeapSTLAllocator.h.

◆ m_poolptr_nc

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

Non-const pointer to the underlying allocator.

Definition at line 542 of file ArenaHeapSTLAllocator.h.


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