kstars
#include <starblockfactory.h>
Public Member Functions | |
~StarBlockFactory () | |
int | freeAll () |
int | freeUnused () |
StarBlock * | getBlock () |
int | getBlockCount () |
bool | markFirst (StarBlock *block) |
bool | markNext (StarBlock *after, StarBlock *block) |
void | printStructure () |
Static Public Member Functions | |
static StarBlockFactory * | Instance () |
Public Attributes | |
quint32 | drawID |
Detailed Description
A factory that creates StarBlocks and recycles them in an LRU Cache.
- Version
- 0.1
Definition at line 32 of file starblockfactory.h.
Constructor & Destructor Documentation
StarBlockFactory::~StarBlockFactory | ( | ) |
Destructor Deletes the linked list that maintains the Cache, sets the pointer to NULL.
Definition at line 43 of file starblockfactory.cpp.
Member Function Documentation
|
inline |
Frees all StarBlocks that are in the cache.
- Returns
- The number of StarBlocks freed
Definition at line 86 of file starblockfactory.h.
int StarBlockFactory::freeUnused | ( | ) |
Frees all StarBlocks that are not used in this draw cycle.
- Returns
- The number of StarBlocks freed
Definition at line 270 of file starblockfactory.cpp.
StarBlock * StarBlockFactory::getBlock | ( | ) |
Return a StarBlock available for use.
This method first checks if there are any cached StarBlocks that are not in use. If such a StarBlock is found, it returns the same for use. Else it freshly allocates a StarBlock and returns the same. It also moves the StarBlock to the front, marking it as the most recently used. If the StarBlock had a parent StarBlockList, this method detaches the StarBlock from the StarBlockList
- Returns
- A StarBlock that is available for use
Definition at line 49 of file starblockfactory.cpp.
|
inline |
Returns the number of StarBlocks currently produced.
- Returns
- Number of StarBlocks currently allocated
Definition at line 80 of file starblockfactory.h.
|
static |
Definition at line 29 of file starblockfactory.cpp.
bool StarBlockFactory::markFirst | ( | StarBlock * | block | ) |
Mark a StarBlock as most recently used and sync its drawID with the current drawID.
- Returns
- true on success, false if the StarBlock supplied was not on our list at all
Definition at line 79 of file starblockfactory.cpp.
Rank a given StarBlock after another given StarBlock in the LRU list and sync its drawID with the current drawID.
- Parameters
-
after The block after which 'block' should be put block The block to mark for use
- Returns
- true on success, false on failure
Definition at line 117 of file starblockfactory.cpp.
void StarBlockFactory::printStructure | ( | ) |
Prints the structure of the cache, for debugging.
Definition at line 244 of file starblockfactory.cpp.
Member Data Documentation
quint32 StarBlockFactory::drawID |
Definition at line 99 of file starblockfactory.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:23 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.