libcommonc++  0.7
AllocationMap Class Reference

An index allocation map. More...

#include <AllocationMap.h++>

Public Member Functions

 AllocationMap (size_t size)
 Construct a new AllocationMap with the given size. More...
 
 ~AllocationMap ()
 Destructor. More...
 
int reserve ()
 Reserve an index from the map. More...
 
bool release (uint_t index)
 Release an index. More...
 
bool isReserved (uint_t index) const
 Determine if a given index is reserved. More...
 
uint_t getSize () const
 Get the size of the map. More...
 

Detailed Description

An index allocation map.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ AllocationMap()

AllocationMap ( size_t  size)

Construct a new AllocationMap with the given size.

Parameters
sizeThe number of indexes to allocate in the map.

◆ ~AllocationMap()

Destructor.

Member Function Documentation

◆ getSize()

uint_t getSize ( ) const
inline

Get the size of the map.

Returns
The number of indexes in the map.

◆ isReserved()

bool isReserved ( uint_t  index) const

Determine if a given index is reserved.

Parameters
indexThe index to test.
Returns
true if the index is reserved, false if it is available.

◆ release()

bool release ( uint_t  index)

Release an index.

Parameters
indexThe index to release.
Returns
true if the index was released, false if the index wasn't reserved or if the index is out of range.

◆ reserve()

int reserve ( )

Reserve an index from the map.

Returns
The reserved index, or -1 if no free index is available.

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