wavelength 1.0.0
Loading...
Searching...
No Matches
blockpool.h
Go to the documentation of this file.
1#pragma once
2
9class BlockPool {
10public:
20 void Init(int nBlockSize, int nNumBlocks, void *pMemory);
21
29 void *Alloc();
30
38 void Free(void *pBlock);
39
41 struct Node {
43 };
44
45private:
46 // Fill in the members and link every block of the region.
47 // NTSC-U/C: 0x0029dac8, PAL: 0x002a7790
48 Node *Setup(int nBlockSize, int nNumBlocks, void *pMemory);
49
50 Node *mMemory;
51 Node *mFree;
52 int mBlockSize;
53 int mNumBlocks;
54};
Pool of equal blocks carved from a region, each free block linking to the next.
Definition blockpool.h:9
void Init(int nBlockSize, int nNumBlocks, void *pMemory)
Take over a region as a chain of free blocks.
void * Alloc()
Hand out the first free block.
void Free(void *pBlock)
Return a block to the head of the chain.
A free block, which starts with the link to the next one.
Definition blockpool.h:41
Node * mNext
Definition blockpool.h:42