The Pedigree Project  0.1
Public Member Functions | Private Attributes | List of all members
ExtensibleBitmap Class Reference

#include <ExtensibleBitmap.h>

+ Collaboration diagram for ExtensibleBitmap:

Public Member Functions

 ExtensibleBitmap ()
 
 ExtensibleBitmap (const ExtensibleBitmap &other)
 
 ~ExtensibleBitmap ()
 
ExtensibleBitmapoperator= (const ExtensibleBitmap &other)
 
void set (size_t n)
 
void clear (size_t n)
 
bool test (size_t n) const
 
size_t getFirstSet () const
 
size_t getFirstClear ()
 
size_t getLastSet () const
 
size_t getLastClear () const
 

Private Attributes

uintptr_t m_StaticMap
 
uint8_t * m_pDynamicMap
 
size_t m_DynamicMapSize
 
size_t m_nMaxBit
 
size_t m_nFirstSetBit
 
size_t m_nFirstClearBit
 
size_t m_nLastSetBit
 
size_t m_nLastClearBit
 

Detailed Description

Defines an "extensible bitmap" - a bitmap that can extend to accommodate any value.

It does not currently deal well with a sparse domain - one bit set at 0x1 and another at 0x100000 will generate a bitmap with 0x100000/0x8 bytes usage.

Definition at line 32 of file ExtensibleBitmap.h.

Constructor & Destructor Documentation

ExtensibleBitmap::ExtensibleBitmap ( )

Creates a new, empty bitmap.

Definition at line 23 of file ExtensibleBitmap.cc.

ExtensibleBitmap::ExtensibleBitmap ( const ExtensibleBitmap other)

Creates a new bitmap identical to that given.

Definition at line 30 of file ExtensibleBitmap.cc.

References m_DynamicMapSize, and m_pDynamicMap.

ExtensibleBitmap::~ExtensibleBitmap ( )

Destroys the bitmap.

Definition at line 66 of file ExtensibleBitmap.cc.

References m_pDynamicMap.

Member Function Documentation

void ExtensibleBitmap::clear ( size_t  n)

Clears the bit in the bitmap indexed by n.

Definition at line 130 of file ExtensibleBitmap.cc.

References m_nFirstSetBit, m_nMaxBit, m_pDynamicMap, m_StaticMap, and test().

Referenced by UsbHub::deviceConnected(), UsbHub::deviceDisconnected(), PosixSubsystem::freeFd(), PosixSubsystem::freeMultipleFds(), and Thread::inhibitEvent().

+ Here is the caller graph for this function:

size_t ExtensibleBitmap::getFirstClear ( )
inline

Returns the index of the first clear bit.

Definition at line 60 of file ExtensibleBitmap.h.

Referenced by UsbHub::deviceConnected().

+ Here is the caller graph for this function:

size_t ExtensibleBitmap::getFirstSet ( ) const
inline

Returns the index of the first set bit.

Definition at line 55 of file ExtensibleBitmap.h.

size_t ExtensibleBitmap::getLastClear ( ) const
inline

Returns the index of the last clear bit.

Definition at line 74 of file ExtensibleBitmap.h.

size_t ExtensibleBitmap::getLastSet ( ) const
inline

Returns the index of the last set bit.

Definition at line 69 of file ExtensibleBitmap.h.

ExtensibleBitmap & ExtensibleBitmap::operator= ( const ExtensibleBitmap other)

Makes this bitmap mirror the one given.

Definition at line 41 of file ExtensibleBitmap.cc.

References m_DynamicMapSize, m_nFirstSetBit, m_nMaxBit, m_pDynamicMap, and m_StaticMap.

void ExtensibleBitmap::set ( size_t  n)

Sets the bit in the bitmap indexed by n.

Definition at line 72 of file ExtensibleBitmap.cc.

References m_DynamicMapSize, m_nFirstSetBit, m_nMaxBit, m_pDynamicMap, m_StaticMap, and test().

Referenced by PosixSubsystem::allocateFd(), PosixSubsystem::copyDescriptors(), UsbHub::deviceConnected(), PosixSubsystem::getFd(), and Thread::inhibitEvent().

+ Here is the caller graph for this function:

bool ExtensibleBitmap::test ( size_t  n) const

Returns the bit in the bitmap indexed by n.

Definition at line 187 of file ExtensibleBitmap.cc.

References m_nMaxBit, m_pDynamicMap, and m_StaticMap.

Referenced by clear(), PosixSubsystem::getFd(), and set().

+ Here is the caller graph for this function:

Member Data Documentation

size_t ExtensibleBitmap::m_DynamicMapSize
private

Amount of memory the dynamic map occupies.

Definition at line 88 of file ExtensibleBitmap.h.

Referenced by ExtensibleBitmap(), operator=(), and set().

size_t ExtensibleBitmap::m_nFirstSetBit
private

First/last bit set/clear indexes.

Definition at line 94 of file ExtensibleBitmap.h.

Referenced by clear(), operator=(), and set().

size_t ExtensibleBitmap::m_nMaxBit
private

Largest stored bit in the dynamic map.

Definition at line 91 of file ExtensibleBitmap.h.

Referenced by clear(), operator=(), set(), and test().

uint8_t* ExtensibleBitmap::m_pDynamicMap
private

The dynamic map, to accommodate bit numbers > {31,63}

Definition at line 85 of file ExtensibleBitmap.h.

Referenced by clear(), ExtensibleBitmap(), operator=(), set(), test(), and ~ExtensibleBitmap().

uintptr_t ExtensibleBitmap::m_StaticMap
private

Performance hint - one statically allocated word. Means we can index data from 0..{31,63} without dynamically allocating anything.

Definition at line 82 of file ExtensibleBitmap.h.

Referenced by clear(), operator=(), set(), and test().


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