A bounds-safe three-dimensional structure of efficiently packed bits. More...
#include <Bitfield3D.h>
Public Member Functions | |
Bitfield3D () | |
Default constructor which initializes to size 0, 0, 0. | |
Bitfield3D (size_t b_size1, size_t b_size2, size_t b_size3) | |
Cosntructor 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 of the total size of the bits is 0. | |
Bitfield::BitfieldBool | operator() (size_t x, size_t y, size_t z) |
Bounds-checked access of the indexed element. More... | |
Bitfield::BitfieldBoolConst | operator() (size_t x, size_t y, size_t z) const |
Const version of operator() | |
Bitfield::BitfieldBool | At (size_t x, size_t y, size_t z) |
Identical to operator() | |
Bitfield::BitfieldBoolConst | At (size_t x, size_t y, size_t z) 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. | |
size_t | size3 () const |
Return the extent in bits of dimension 3. | |
void | Zero () |
Set all bits to 0 / false. | |
void | Zero2D (const size_t z) |
Set all bits of dimensions 1 and 2 to zero at z indexed dimension 3. | |
void | Zero1D (const size_t y, const size_t z) |
Set all bits of dimension 1 to zero at y and z indexed dimensions 2 and 3. | |
bool | Check (const size_t x, const size_t y, const size_t z) const |
True of indices x, y, and z are all in bounds. | |
void | Assert (const size_t x, const size_t y, const size_t z) const |
Throws ErrorMsgBounds if index x, y, or z is out of bounds. | |
Friends | |
void | swap (Bitfield3D &a, Bitfield3D &b) |
Swap the data in Bitfield3D a and b. | |
A bounds-safe three-dimensional structure of efficiently packed bits.
Note AxBxC dimensions take ABC bits of storage with the total rounded up to the nearest 32 bit word.
|
inlineexplicit |
Cosntructor 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. |
b_size3 | The size of the third dimension. |
|
inline |
Bounds-checked access of the indexed element.
Throws an ErrorMsgBounds exception if x, y, or z 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. |
z | The dimension 3 index of the bit to access. |