Created
August 24, 2017 06:56
-
-
Save luyao795/40a98a7e3e4b6c6736c89a37a17d1687 to your computer and use it in GitHub Desktop.
Header file for Fixed Size Allocator Manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef FSAMANAGER_H | |
#define FSAMANAGER_H | |
#include <vector> | |
#include "FixedSizeAllocator.h" | |
#define NUM_FSA 4 | |
namespace Engine | |
{ | |
class FSAManager | |
{ | |
public: | |
FSAManager(); | |
static FSAManager* create(); | |
static FSAManager* getInstance(); | |
void destroy(); | |
void createFSA(); | |
bool isListEmpty(FixedSizeAllocator* list[], const size_t length); | |
void clearList(FixedSizeAllocator* list[], const size_t length); | |
FixedSizeAllocator* findFixedSizeAllocator(size_t size); | |
FixedSizeAllocator** getList(); | |
private: | |
~FSAManager(); | |
static BlockAllocator* inst; | |
static const size_t numFSA = 4; | |
// Size: 8, 16, 32, 64 | |
const size_t multiplier[4] = {1, 2, 4, 8}; | |
const size_t smallestSize = 8; | |
const size_t numBlock = 100; | |
static FSAManager* instance; | |
//static FixedSizeAllocator** list; | |
static FixedSizeAllocator* fixedList[NUM_FSA]; | |
}; | |
} | |
#endif // !FSAMANAGER_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment