Quark  0.1
AllocationMap Class Reference

An index allocation map. More...

#include <AllocationMap.h++>

Public Member Functions

 AllocationMap (int size)
 Constructs a new AllocationMap of the specified size. More...
 
 ~AllocationMap ()
 Destructor. More...
 
int reserve ()
 Reserves an index in the map. More...
 
void reserve (int index)
 Reserves the specified index in the map. More...
 
void release (int index)
 Releases an index. More...
 
bool isReserved (int index) const
 Tests if a given index is reserved. More...
 
void clear ()
 Clears the allocation map. More...
 
int getSize () const
 Returns the size of the AllocationMap. More...
 

Detailed Description

An index allocation map.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ AllocationMap()

AllocationMap ( int  size)

Constructs a new AllocationMap of the specified size.

◆ ~AllocationMap()

Destructor.

Member Function Documentation

◆ clear()

void clear ( )

Clears the allocation map.

Releases every reserved index.

◆ getSize()

int getSize ( ) const
inline

Returns the size of the AllocationMap.

◆ isReserved()

bool isReserved ( int  index) const

Tests if a given index is reserved.

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

◆ release()

void release ( int  index)

Releases 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() [1/2]

int reserve ( )

Reserves an index in the map.

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

◆ reserve() [2/2]

void reserve ( int  index)

Reserves the specified index in the map.

Parameters
indexThe index to reserve.

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