home | project pages | download | documentation | doxygen | contact |
#include <FreeList.h>
If one would have an array fixed sized items, one would like to know which of these items are still free.
With this class we have a list of all the items that are not yet used by the application.
Public Member Functions | |
FreeList (uint32_t _nr_items) | |
Construct a new free list. | |
~FreeList () | |
Destruct the free list. | |
uint32_t | alloc () |
Get a free item. | |
void | free (uint32_t item_nr) |
Give back an item. | |
uint32_t | arraySize () |
Find out how large the array is. | |
Private Member Functions | |
void | merge (std::list< free_region_t * >::iterator) |
Merges two regions together, leaving one. | |
Private Attributes | |
uint32_t | nr_items |
The number of items this class manages. | |
std::list< free_region_t * > | regions |
A set of regions, see. |
camvox::FreeList::FreeList | ( | uint32_t | _nr_items | ) |
Construct a new free list.
_nr_items | maximum number of items to manage |
camvox::FreeList::~FreeList | ( | ) |
Destruct the free list.
void camvox::FreeList::merge | ( | std::list< free_region_t * >::iterator | i | ) | [private] |
Merges two regions together, leaving one.
uint32_t camvox::FreeList::alloc | ( | ) |
Get a free item.
void camvox::FreeList::free | ( | uint32_t | item_nr | ) |
Give back an item.
item_nr | the item to bring back to the free list. |
uint32_t camvox::FreeList::arraySize | ( | void | ) |
Find out how large the array is.
This is used to figure out how large the item array needs to be as a mimimum.
uint32_t camvox::FreeList::nr_items [private] |
The number of items this class manages.
std::list<free_region_t *> camvox::FreeList::regions [private] |