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);
133 const unsigned char& numBlocks =
UCHAR_MAX);
194 #ifndef GUM_NO_INLINE 195 # include <agrum/tools/core/smallobjectallocator/fixedAllocator_inl.h> void * allocate()
Allocates a block.
void deallocate(void *pDeallocatedBlock)
Deallocates a block.
unsigned char firstAvailableBlock__
Holds the index of the first block available in this chunck.
FixedAllocator(const std::size_t &blockSize, const unsigned char &numBlocks=UCHAR_MAX)
Constructor.
void init__(const std::size_t &blockSize, const unsigned char &numBlocks)
Initializes a Chunk object.
void deallocat__(void *p, const std::size_t &blockSize)
Deallocates a block of memory.
INLINE void emplace(Args &&... args)
unsigned char blocksAvailable__
Number of blocks available in this chunck.
Allocates objects of one given size.
void release__()
Releases the allocated memory.
Chunks__::iterator deallocChunk__
Last Chunk used for a deallocation.
unsigned char * pData__
Pointer to the managed memory itself.
void * allocate__(const std::size_t &blockSize)
Allocates a block of memory.
Allocates objects of one given size.
const size_t & objectSize()
Returns the size of block allocated by this FixedAllocator.
std::size_t blockSize__
Size of a memory block allocated.
~FixedAllocator()
Destructor.
std::vector< Chunk__ > Chunks__
Vector of Chunk__ objects.
Chunks__::iterator allocChunk__
Last Chunk used for an allocation.
unsigned char numBlocks__
The maximum number of blocks a chunk can allocate.