Tangible serialization and design improvements
This commit is contained in:
@@ -128,22 +128,32 @@ public:
|
||||
class IdPlayerPool {
|
||||
private:
|
||||
IdGlobalPool *global_;
|
||||
bool fifo_enabled_;
|
||||
std::deque<int64_t> ranges_;
|
||||
friend int unittests_idalloc(lua_State *L);
|
||||
|
||||
public:
|
||||
// Construct a player pool.
|
||||
// The Player pool stores a pointer to the global pool.
|
||||
IdPlayerPool(IdGlobalPool *igp);
|
||||
//
|
||||
// The fifo is initially in the disabled state. In the disabled state, the
|
||||
// fifo is not kept filled. You can still use the allocator when the fifo is
|
||||
// disabled - doing so just fetches a batch from the global pool.
|
||||
//
|
||||
IdPlayerPool(IdGlobalPool *g);
|
||||
~IdPlayerPool();
|
||||
|
||||
// Refill the fifo queue of batches from the global pool.
|
||||
void refill();
|
||||
// Enable or disable the fifo.
|
||||
void enable_fifo();
|
||||
void disable_fifo();
|
||||
bool fifo_enabled() { return fifo_enabled_; }
|
||||
|
||||
// Return all batches to the global pool. Leave the fifo empty.
|
||||
// Return all batches from the fifo to the global pool.
|
||||
void unqueue();
|
||||
|
||||
// Discard all batches. This is only for unit testing.
|
||||
// Refill the fifo of batches from the global pool.
|
||||
void refill();
|
||||
|
||||
// Discard all batches in the fifo. This is only for unit testing.
|
||||
void purge();
|
||||
|
||||
// Get a batch from the fifo. Also refills the fifo.
|
||||
|
||||
Reference in New Issue
Block a user