SBitfield Class Reference
[Utility Classes and Functions]

#include <support/Bitfield.h>

List of all members.


Detailed Description

Vector of bits.

The bitfield is stored as an array of 32 bits words on the heap. However, if the bitfield is smaller than 33 bits, it is stored inline. Test(), Set() and Clear() are "unsafe" in the sense that they won't check the input parameter (wether or not the bit requested is in or out the bitfield), so be careful when using those methods.


Public Member Functions

void Clear (size_t bit)
 This call doesn't make sure that bit is valid.
status_t Clear (size_t start, size_t len)
 Clear several continuous bits in the bitfield.
size_t CountBits () const
 Return current # bits in bitfield.
ssize_t FirstClear () const
 Search for the first bit cleared in the bitfield.
ssize_t FirstSet () const
 Search for the first bit set in the bitfield.
status_t InitCheck () const
 B_NO_MEMORY if the bitfield couldn't be allocated.
bool operator== (const SBitfield &other)
 Compare 2 bitfields.
bool operator[] (size_t bit) const
bitfield_bit operator[] (size_t bit)
 Read or write the bitfield as an array.
status_t Resize (size_t bits)
 Change the size of the bitfield.
 SBitfield (const SBitfield &copy)
 SBitfield (size_t size, bool intial)
 Contruct a bitfield of size bits, initialize all values to initial.
 SBitfield (size_t size=0)
 Contruct a bitfield of size bits.
void Set (size_t bit)
 This call doesn't make sure that bit is valid.
status_t Set (size_t start, size_t len)
 Set several continuous bits in the bitfield.
bool Test (size_t bit) const
 Test a bit in the bitfield This call doesn't make sure that bit is valid.
bool TestAndSet (size_t bit)
 Set a bit in the bitfield, returning its old value This call doesn't make sure that bit is valid.
 ~SBitfield ()

Friends

struct bitfield_bit

Classes

struct  bitfield_bit


Constructor & Destructor Documentation

SBitfield size_t  size = 0  ) 
 

Contruct a bitfield of size bits.

SBitfield size_t  size,
bool  intial
 

Contruct a bitfield of size bits, initialize all values to initial.

SBitfield const SBitfield copy  ) 
 

~SBitfield  ) 
 


Member Function Documentation

void Clear size_t  bit  )  [inline]
 

This call doesn't make sure that bit is valid.

status_t Clear size_t  start,
size_t  len
 

Clear several continuous bits in the bitfield.

size_t CountBits  )  const [inline]
 

Return current # bits in bitfield.

ssize_t FirstClear  )  const
 

Search for the first bit cleared in the bitfield.

ssize_t FirstSet  )  const
 

Search for the first bit set in the bitfield.

status_t InitCheck  )  const
 

B_NO_MEMORY if the bitfield couldn't be allocated.

bool operator== const SBitfield other  ) 
 

Compare 2 bitfields.

bool operator[] size_t  bit  )  const [inline]
 

bitfield_bit operator[] size_t  bit  )  [inline]
 

Read or write the bitfield as an array.

status_t Resize size_t  bits  ) 
 

Change the size of the bitfield.

void Set size_t  bit  )  [inline]
 

This call doesn't make sure that bit is valid.

status_t Set size_t  start,
size_t  len
 

Set several continuous bits in the bitfield.

bool Test size_t  bit  )  const [inline]
 

Test a bit in the bitfield This call doesn't make sure that bit is valid.

bool TestAndSet size_t  bit  ) 
 

Set a bit in the bitfield, returning its old value This call doesn't make sure that bit is valid.


Friends And Related Function Documentation

friend struct bitfield_bit [friend]
 


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