Manages a pool of ScreenLogCommand objects for efficient reuse. More...
#include <ScreenLogCommandPool.h>
Public Member Functions | |
ScreenLogCommandPool (const ScreenLogCommandPool &)=delete | |
ScreenLogCommandPool & | operator= (const ScreenLogCommandPool &)=delete |
ScreenLogCommand * | GetCommand (std::string str, SpriteFont *font, int x, int y) |
Retrieves a command from the pool or creates a new one if the pool is empty. | |
void | ReturnCommand (ScreenLogCommand *cmd) |
Returns a ScreenLogCommand to the pool. | |
Private Attributes | |
std::queue< ScreenLogCommand * > | commandPool |
Queue of available ScreenLogCommand objects for reuse. | |
Manages a pool of ScreenLogCommand objects for efficient reuse.
The ScreenLogCommandPool class is responsible for managing a pool of ScreenLogCommand objects, allowing for efficient reuse of command objects to minimize memory allocation overhead.
ScreenLogCommand * ScreenLogCommandPool::GetCommand | ( | std::string | str, |
SpriteFont * | font, | ||
int | x, | ||
int | y ) |
Retrieves a command from the pool or creates a new one if the pool is empty.
void ScreenLogCommandPool::ReturnCommand | ( | ScreenLogCommand * | cmd | ) |
Returns a ScreenLogCommand to the pool.
cmd | Pointer to the ScreenLogCommand to return. |