Loading...
Searching...
No Matches
cxx::Bitmap_base Class Reference

Basic bitmap abstraction. More...

`#include <bitmap>`

Inheritance diagram for cxx::Bitmap_base:
Collaboration diagram for cxx::Bitmap_base:

## Data Structures

class | Bit
| A writable bit in a bitmap. More...
class | Word
| Helper abstraction for a word contained in the bitmap. More...
class | Char
| Helper abstraction for a byte contained in the bitmap. More...

## Public Member Functions

void | bit (long bit, bool on) noexcept
| Set the value of bit bit to on.
void | clear_bit (long bit) noexcept
| Clear bit bit.
void | atomic_clear_bit (long bit) noexcept
| Clear bit bit atomically.
word_type | atomic_get_and_clear (long bit) noexcept
| Clear bit bit atomically and return old state.
void | set_bit (long bit) noexcept
| Set bit bit.
void | atomic_set_bit (long bit) noexcept
| Set bit bit atomically.
word_type | atomic_get_and_set (long bit) noexcept
| Set bit bit atomically and return old state.
word_type | bit (long bit) const noexcept
| Get the truth value of a bit.
word_type | operator[] (long bit) const noexcept
| Get the bit at index bit.
Bit | operator[] (long bit) noexcept
| Get the lvalue for the bit at index bit.
long | scan_zero (long max_bit, long start_bit=0) const noexcept
| Scan for the first zero bit.

## Static Public Member Functions

static long | words (long bits) noexcept
| Get the number of Words that are used for the bitmap.
static long | chars (long bits) noexcept
| Get the number of chars that are used for the bitmap.

## Protected Types

enum | { W_bits = sizeof(word_type) * 8 , C_bits = 8 }
typedef unsigned long | word_type
| Data type for each element of the bit buffer.

## Static Protected Member Functions

static unsigned | word_index (unsigned bit)
| Get the word index for the given bit.
static unsigned | bit_index (unsigned bit)
| Get the bit index within word_type for the given bit.

## Protected Attributes

word_type * | _bits
| Pointer to the buffer storing the bits.

## Detailed Description

Basic bitmap abstraction.

This abstraction keeps a pointer to a memory area that is used as bitmap.

Definition at line 18 of file bitmap.

## Member Enumeration Documentation

## anonymous enum

anonymous enum

protected

Enumerator
W_bits | number of bits in word_type
C_bits | number of bits in char

Definition at line 26 of file bitmap.

## Member Function Documentation

## atomic_clear_bit()

void cxx::Bitmap_base::atomic_clear_bit | ( | long | bit | ) |

inlinenoexcept

Clear bit bit atomically.

Use this function for multi-threaded access to the bitmap.

Parameters

  bit | The number of the bit to clear.

Definition at line 269 of file bitmap.

References _bits, bit(), bit_index(), and word_index().

Here is the call graph for this function:

## atomic_get_and_clear()

Bitmap_base::word_type cxx::Bitmap_base::atomic_get_and_clear | ( | long | bit | ) |

inlinenoexcept

Clear bit bit atomically and return old state.

Use this function for multi-threaded access to the bitmap.

Parameters

  bit | The number of the bit to clear.

Definition at line 279 of file bitmap.

References _bits, bit(), bit_index(), and word_index().

Here is the call graph for this function:

## atomic_get_and_set()

Bitmap_base::word_type cxx::Bitmap_base::atomic_get_and_set | ( | long | bit | ) |

inlinenoexcept

Set bit bit atomically and return old state.

Use this function for multi-threaded access to the bitmap.

Parameters

  bit | The number of the bit to set.

Definition at line 308 of file bitmap.

References _bits, bit(), bit_index(), and word_index().

Here is the call graph for this function:

## atomic_set_bit()

void cxx::Bitmap_base::atomic_set_bit | ( | long | bit | ) |

inlinenoexcept

Set bit bit atomically.

Use this function for multi-threaded access to the bitmap.

Parameters

  bit | The number of the bit to set.

Definition at line 298 of file bitmap.

References _bits, bit(), bit_index(), and word_index().

Here is the call graph for this function:

## bit() [1/2]

Bitmap_base::word_type cxx::Bitmap_base::bit | ( | long | bit | ) | const

inlinenoexcept

Get the truth value of a bit.

Parameters

  bit | The number of the bit to read.

Return values

  0 | Bit is not set.
  != | 0 Bit is set.

Definition at line 318 of file bitmap.

References _bits, bit(), bit_index(), and word_index().

Here is the call graph for this function:

## bit() [2/2]

void cxx::Bitmap_base::bit | ( | long | bit,
|  | bool | on )

inlinenoexcept

Set the value of bit bit to on.

Parameters

  bit | The number of the bit.
  on | The boolean value that shall be assigned to the bit.

Definition at line 251 of file bitmap.

References _bits, bit(), bit_index(), and word_index().

Referenced by atomic_clear_bit(), atomic_get_and_clear(), atomic_get_and_set(), atomic_set_bit(), bit(), bit(), bit_index(), clear_bit(), operator[](), operator[](), set_bit(), and word_index().

Here is the call graph for this function:
Here is the caller graph for this function:

## bit_index()

unsigned cxx::Bitmap_base::bit_index | ( | unsigned | bit | ) |

inlinestaticprotected

Get the bit index within word_type for the given bit.

Parameters

  bit | The bit index in the bitmap.

Returns
  the bit index within word_type (bit % W_bits).

Definition at line 53 of file bitmap.

References bit(), and W_bits.

Referenced by atomic_clear_bit(), atomic_get_and_clear(), atomic_get_and_set(), atomic_set_bit(), bit(), bit(), clear_bit(), and set_bit().

Here is the call graph for this function:
Here is the caller graph for this function:

## clear_bit()

void cxx::Bitmap_base::clear_bit | ( | long | bit | ) |

inlinenoexcept

Clear bit bit.

Parameters

  bit | The number of the bit to clear.

Definition at line 260 of file bitmap.

References _bits, bit(), bit_index(), and word_index().

Here is the call graph for this function:

## operator[]() [1/2]

word_type cxx::Bitmap_base::operator[] | ( | long | bit | ) | const

inlinenoexcept

Get the bit at index bit.

Parameters

  bit | The number of the bit to read.

Return values

  0 | Bit is not set.
  != | 0 Bit is set.

Definition at line 181 of file bitmap.

References bit().

Here is the call graph for this function:

## operator[]() [2/2]

Bit cxx::Bitmap_base::operator[] | ( | long | bit | ) |

inlinenoexcept

Get the lvalue for the bit at index bit.

Parameters

  bit | The number.

Returns
  lvalue for bit

Definition at line 191 of file bitmap.

References bit().

Here is the call graph for this function:

## scan_zero()

long cxx::Bitmap_base::scan_zero | ( | long | max_bit,
|  | long | start_bit = 0 ) const

inlinenoexcept

Scan for the first zero bit.

Parameters

  max_bit | Upper bound (exclusive) for the scanning operation.
  start_bit | Hint at the number of the first bit to look at. Zero bits below start_bit may or may not be taken into account by the implementation.

Return values

  >= | 0 Number of first zero bit found.
  -1 | All bits between start_bit and max_bit are set.

Definition at line 339 of file bitmap.

References _bits, W_bits, and word_index().

Referenced by cxx::Bitmap< BITS >::scan_zero().

Here is the call graph for this function:
Here is the caller graph for this function:

## set_bit()

void cxx::Bitmap_base::set_bit | ( | long | bit | ) |

inlinenoexcept

Set bit bit.

Parameters

  bit | The number of the bit to set.

Definition at line 289 of file bitmap.

References _bits, bit(), bit_index(), and word_index().

Here is the call graph for this function:

## word_index()

unsigned cxx::Bitmap_base::word_index | ( | unsigned | bit | ) |

inlinestaticprotected

Get the word index for the given bit.

Parameters

  bit | The index of the bit in question.

Returns
  the index in Bitmap_base::_bits for the given bit (bit / W_bits).

Definition at line 44 of file bitmap.

References bit(), and W_bits.

Referenced by atomic_clear_bit(), atomic_get_and_clear(), atomic_get_and_set(), atomic_set_bit(), bit(), bit(), clear_bit(), scan_zero(), and set_bit().

Here is the call graph for this function:
Here is the caller graph for this function:

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

- l4/cxx/bitmap