A bounds-safe two-dimensional structure of efficiently packed bits. More...
#include <Bitfield2D.h>
Public Member Functions | |
| Bitfield2D () | |
| Default constructor which initializes to size 0, 0. | |
| Bitfield2D (size_t b_size1, size_t b_size2) | |
| Constructor which sets the initial sizes. More... | |
| void | Delete () |
| Deletes the stored data, resets the sizes to 0, and releases the memory. | |
| bool | IsEmpty () const |
| True if the total size of the bits is 0. | |
| Bitfield::BitfieldBool | operator() (size_t x, size_t y) |
| Bounds-checked access of the indexed element. More... | |
| Bitfield::BitfieldBoolConst | operator() (size_t x, size_t y) const |
| Const version of operator() | |
| Bitfield::BitfieldBool | At (size_t x, size_t y) |
| Identical to operator() | |
| Bitfield::BitfieldBoolConst | At (size_t x, size_t y) const |
| Const version of At() | |
| size_t | size1 () const |
| Return the extent in bits of dimension 1. | |
| size_t | size2 () const |
| Return the extent in bits of dimension 2. | |
| void | Zero () |
| Set all bits to 0 / false. | |
| void | Zero1D (const size_t y) |
| Set all bits of dimension 1 to zero at y indexed dimension 2. | |
| bool | Check (const size_t x, const size_t y) const |
| True if indices x and y are both in bounds. | |
| void | Assert (const size_t x, const size_t y) const |
| Throws ErrorMsgBounds if index x or y is out of bounds. | |
Friends | |
| void | swap (Bitfield2D &a, Bitfield2D &b) |
| Swap the data in Bitfield2D a and b. | |
A bounds-safe two-dimensional structure of efficiently packed bits.
Note AxB and BxA dimensions will both take AB bits of storage with the total rounded up to the nearest 32 bit word.
|
inlineexplicit |
Constructor which sets the initial sizes.
Efficiency note: The first dimension, set by b_size1, should be the one which is iterated over most frequently in innermost loops for caching gains.
| b_size1 | The size of the first dimension. |
| b_size2 | The size of the second dimension. |
|
inline |
Bounds-checked access of the indexed element.
Throws an ErrorMsgBounds exception if x or y is out of the bounds.
| x | The dimension 1 index of the bit to access. |
| y | The dimension 2 index of the bit to access. |
1.9.1