|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #ifndef ATLALLOCATORS_ARENAALLOCATORBASE_H
17 #define ATLALLOCATORS_ARENAALLOCATORBASE_H
24 #include <type_traits>
214 static void header (std::ostream&
os);
282 virtual const std::string&
name()
const = 0;
289 virtual void report (std::ostream&
os)
const;
311 template <
typename T,
313 bool no_ctor =
false,
314 bool no_dtor =
false>
320 "Requested Alignment larger than the one that can be provided");
376 template <
typename T>
384 template <
typename T>
392 template <
typename T>
420 #endif // not ATLALLOCATORS_ARENAALLOCATORBASE_H
func_t * constructor
Constructor function for elements.
virtual Stats stats() const =0
Return the statistics block for this allocator.
initParams(size_t nblock=1000, const std::string &name="")
Constructor.
size_t nblock
The number of elements we should allocate in a single block (hint only).
size_t m_nblock
Saved value of the number of elements to allocate per block.
bool mustClear
If true, the clear call cannot be skipped before destructor.
size_t free
Number of items currently not allocated by the application but cached by the allocator.
virtual void reserve(size_t size)=0
Set the total number of elements cached by the allocator.
func_t * clear
Clear function for elements.
virtual void erase()=0
Free all allocated elements and release memory back to the system.
size_t inuse
Number of items currently allocated by the application.
Stat blocks
Counts of blocks.
void clear()
Reset to zero.
void func_t(pointer)
Type of functions for constructor, etc.
static func_t * makeConstructor(const std::true_type &)
Make a constructor function pointer for a trivial constructor.
void clear()
Reset to zero.
std::string m_name
Saved value of the allocator name.
Statistics for an allocator.
Stat & operator+=(const Stat &other)
Accumulate.
Common base class for arena allocator classes.
static func_t * makeDestructor(const std::true_type &)
Make a constructor function pointer for a trivial destructor.
static void construct_fcn(pointer p)
Call T's default constructor on the object at p.
virtual void report(std::ostream &os) const
Generate a report on the memory usage of this allocator.
constexpr size_t alignment
static void destroy_fcn(pointer p)
Call T's destructor on the object at p.
static func_t * makeClear(const std::true_type &)
Make a dummy clear function pointer.
std::string name
The name of this allocator.
Stat bytes
Counts of bytes.
static void clear_fcn(pointer p)
Call T::clear on the object at p.
Stat()
Default constructor.
size_t total
Total number of items held by the allocator.
const char * const_pointer
And a const version of the pointer.
size_t linkOffset
Offset from the start of a free element to a pointer to be used by the allocator.
Params params() const
Return an initialized parameters structure.
static func_t * makeDestructor(const std::false_type &)
Make a constructor function pointer for a non-trivial destructor.
static func_t * makeConstructor(const std::false_type &)
Make a constructor function pointer for a non-trivial constructor.
static void header(std::ostream &os)
Print report header.
virtual ~ArenaAllocatorBase()
Destructor.
bool canReclear
If true, clear can be called more than once on a given element.
size_t eltSize
The size in bytes of the individual elements we're allocating.
Helper to initialize a parameters structure.
char * pointer
Type for pointers to elements.
A dummy pad struct to put at the end of the ArenaBlock header to ensure the alignment of the elements...
virtual void reset()=0
Free all allocated elements.
size_t minSize
The minimum size that this Allocator allows for an element.
static func_t * makeClear(const std::false_type &)
Make a function pointer for a clear function.
std::ostream & operator<<(std::ostream &os, const ArenaAllocatorBase::Stats::Stat &stat)
Format a statistic structure.
Stats & operator+=(const Stats &other)
Accumulate.
func_t * destructor
Destructor function for elements.
Stat elts
Counts of elements.
virtual const std::string & name() const =0
Return the name of this allocator.