2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 * @file AthAllocators/ArenaBlock.icc
8 * @brief These are large blocks of memory that get allocated and
9 * divided up into smaller, uniform elements.
10 * Inline/template implementations.
17 * @brief Return the number of elements in the block.
20 size_t ArenaBlock::size() const
27 * @brief Return the size of the elements in the block.
30 size_t ArenaBlock::eltSize() const
37 * @brief Return the link pointer of the block.
40 ArenaBlock*& ArenaBlock::link()
47 * @brief Return the link pointer of the block.
50 const ArenaBlock* ArenaBlock::link() const
57 * @brief Return a pointer to element @c i in the block.
58 * @param i The index of the desired element.
61 ArenaBlock::pointer ArenaBlock::index (size_t i)
63 return reinterpret_cast<char*>(this) +
64 ArenaBlockBodyOffset + i*eltSize();
69 * @brief Return a pointer to element @c i in the block.
70 * @param i The index of the desired element.
73 ArenaBlock::const_pointer ArenaBlock::index (size_t i) const
75 return reinterpret_cast<const char*>(this) +
76 ArenaBlockBodyOffset + i*eltSize();
81 * @brief Return a pointer to element @c i in the block.
82 * @param i The index of the desired element.
83 * @param elt_size The block's element size.
85 * This is provided in addition to the previous function as it may
86 * allow for better inlined code in when used in a loop, if @c elt_size
87 * is saved in a local.
90 ArenaBlock::pointer ArenaBlock::index (size_t i, size_t elt_size)
92 return reinterpret_cast<char*>(this) + ArenaBlockBodyOffset + i*elt_size;
97 * @brief Return a pointer to element @c i in the block.
98 * @param i The index of the desired element.
99 * @param elt_size The block's element size.
101 * This is provided in addition to the previous function as it may
102 * allow for better inlined code in when used in a loop, if @c elt_size
103 * is saved in a local.
106 ArenaBlock::const_pointer ArenaBlock::index (size_t i, size_t elt_size) const
108 return reinterpret_cast<const char*>(this) + ArenaBlockBodyOffset + i*elt_size;
113 * @brief Return the global number of blocks in use.
116 size_t ArenaBlock::nactive()