30 #ifndef GUM_FIXED_ALLOCATOR_H 31 #define GUM_FIXED_ALLOCATOR_H 37 #include <agrum/agrum.h> 84 void _init_(
const std::size_t& blockSize,
const unsigned char& numBlocks);
89 void*
_allocate_(
const std::size_t& blockSize);
94 void _deallocat_(
void* p,
const std::size_t& blockSize);
193 #ifndef GUM_NO_INLINE 194 # include <agrum/tools/core/smallobjectallocator/fixedAllocator_inl.h> void * allocate()
Allocates a block.
void deallocate(void *pDeallocatedBlock)
Deallocates a block.
FixedAllocator(const std::size_t &blockSize, const unsigned char &numBlocks=UCHAR_MAX)
Constructor.
unsigned char _firstAvailableBlock_
Holds the index of the first block available in this chunck.
INLINE void emplace(Args &&... args)
unsigned char * _pData_
Pointer to the managed memory itself.
std::vector< _Chunk_ > _Chunks_
Vector of Chunk objects.
unsigned char _blocksAvailable_
Number of blocks available in this chunck.
_Chunks_::iterator _allocChunk_
Last Chunk used for an allocation.
void _release_()
Releases the allocated memory.
Allocates objects of one given size.
void * _allocate_(const std::size_t &blockSize)
Allocates a block of memory.
unsigned char _numBlocks_
The maximum number of blocks a chunk can allocate.
void _init_(const std::size_t &blockSize, const unsigned char &numBlocks)
Initializes a Chunk object.
Allocates objects of one given size.
const size_t & objectSize()
Returns the size of block allocated by this FixedAllocator.
~FixedAllocator()
Destructor.
_Chunks_::iterator _deallocChunk_
Last Chunk used for a deallocation.
void _deallocat_(void *p, const std::size_t &blockSize)
Deallocates a block of memory.
std::size_t _blockSize_
Size of a memory block allocated.