SourceForge.net Logo

camvox::FreeList Class Reference

#include <FreeList.h>

List of all members.


Detailed Description

This class manages free items.

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.

Constructor & Destructor Documentation

camvox::FreeList::FreeList ( uint32_t  _nr_items  ) 

Construct a new free list.

Parameters:
_nr_items maximum number of items to manage

camvox::FreeList::~FreeList (  ) 

Destruct the free list.


Member Function Documentation

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.

Returns:
a free item.

void camvox::FreeList::free ( uint32_t  item_nr  ) 

Give back an item.

Parameters:
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.

Returns:
The minimum array size to hold all items.


Member Data Documentation

uint32_t camvox::FreeList::nr_items [private]

The number of items this class manages.

std::list<free_region_t *> camvox::FreeList::regions [private]

A set of regions, see.

See also:
struct free_region_s.


The documentation for this class was generated from the following files: