21 #ifndef GF_SPATIAL_BLOCK_ALLOCATOR_H 22 #define GF_SPATIAL_BLOCK_ALLOCATOR_H 28 #ifndef DOXYGEN_SHOULD_SKIP_THIS 38 : m_firstFreeBlock(NullIndex)
46 if (m_firstFreeBlock != NullIndex) {
47 index = m_firstFreeBlock;
48 m_firstFreeBlock = m_blocks[index].next;
51 index = m_blocks.size();
52 m_blocks.push_back(
Block());
55 assert(index < m_blocks.size());
56 assert(m_blocks[index].next == NullIndex);
63 assert(index < m_blocks.size());
64 m_blocks[index].next = m_firstFreeBlock;
65 m_firstFreeBlock = index;
70 assert(index < m_blocks.size());
71 assert(m_blocks[index].next == NullIndex);
72 return m_blocks[index].data;
76 assert(index < m_blocks.size());
77 assert(m_blocks[index].next == NullIndex);
78 return m_blocks[index].data;
96 std::size_t m_firstFreeBlock;
97 std::vector<Block> m_blocks;
98 std::size_t m_allocated;
102 #ifndef DOXYGEN_SHOULD_SKIP_THIS 108 #endif // GF_SPATIAL_BLOCK_ALLOCATOR_H const T & operator[](std::size_t index) const
Definition: BlockAllocator.h:75
void dispose(std::size_t index)
Definition: BlockAllocator.h:62
T & operator[](std::size_t index)
Definition: BlockAllocator.h:69
std::size_t getAllocated() const
Definition: BlockAllocator.h:86
The namespace for gf classes.
Definition: Action.h:35
Definition: BlockAllocator.h:35
std::size_t allocate()
Definition: BlockAllocator.h:43
The socket would have blocked.
BlockAllocator()
Definition: BlockAllocator.h:37
constexpr std::size_t NullIndex
Definition: BlockAllocator.h:32
void clear()
Definition: BlockAllocator.h:81