simple 2D bit array. More...
#include <vbl_bit_array_2d.h>
Public Member Functions | |
vbl_bit_array_2d () | |
vbl_bit_array_2d (unsigned int m, unsigned int n) | |
Construct num_rows x num_cols array and leave data uninitialised. | |
vbl_bit_array_2d (unsigned int m, unsigned int n, bool v) | |
Construct num_rows x num_cols array and fill all cells with v. | |
vbl_bit_array_2d (unsigned int m, unsigned int n, bool v[]) | |
Construct num_rows x num_cols array and fill all cells with v. | |
vbl_bit_array_2d (vbl_bit_array_2d const &) | |
Copy constructor. | |
~vbl_bit_array_2d () | |
vbl_bit_array_2d & | operator= (vbl_bit_array_2d const &) |
Assignment operator. | |
bool | operator== (vbl_bit_array_2d const &a) const |
Comparison. | |
bool | operator!= (vbl_bit_array_2d const &a) const |
void | fill (bool value) |
Fill with value. | |
void | resize (unsigned int m, unsigned int n) |
Delete contents and resize to m rows x n cols. | |
void | enlarge (unsigned int m, unsigned int n) |
Resizes and pads with zeros; keeps existing data. | |
void | clear () |
make as if default-constructed. | |
bool | operator() (unsigned int i, unsigned int j) const |
bool | operator() (unsigned int i, unsigned int j) |
void | put (unsigned int i, unsigned int j, bool const &x) |
bool | get (unsigned int i, unsigned int j) const |
void | set (unsigned int i, unsigned int j, bool v=true) |
Set the value of a cell; default is to set the value on. | |
void | flip (unsigned int i, unsigned int j) |
Change the value of a cell. | |
unsigned int | rows () const |
unsigned int | cols () const |
unsigned int | columns () const |
unsigned long | size () const |
Number of bytes allocated by the data. | |
Private Member Functions | |
void | destruct () |
void | construct (unsigned int m, unsigned int n) |
void | index (unsigned int x, unsigned int y, unsigned long &byteindex, unsigned int &bitindex) const |
Private Attributes | |
unsigned char * | data_ |
unsigned int | num_rows_ |
unsigned int | num_cols_ |
simple 2D bit array.
essentially identical to vbl_array_2d<bool> but more efficiently stored
Definition at line 22 of file vbl_bit_array_2d.h.
vbl_bit_array_2d::vbl_bit_array_2d | ( | ) | [inline] |
Definition at line 26 of file vbl_bit_array_2d.h.
vbl_bit_array_2d::vbl_bit_array_2d | ( | unsigned int | m, |
unsigned int | n | ||
) | [inline] |
Construct num_rows x num_cols array and leave data uninitialised.
Definition at line 28 of file vbl_bit_array_2d.h.
vbl_bit_array_2d::vbl_bit_array_2d | ( | unsigned int | m, |
unsigned int | n, | ||
bool | v | ||
) | [inline] |
Construct num_rows x num_cols array and fill all cells with v.
Definition at line 30 of file vbl_bit_array_2d.h.
vbl_bit_array_2d::vbl_bit_array_2d | ( | unsigned int | m, |
unsigned int | n, | ||
bool | v[] | ||
) |
Construct num_rows x num_cols array and fill all cells with v.
Definition at line 26 of file vbl_bit_array_2d.cxx.
vbl_bit_array_2d::vbl_bit_array_2d | ( | vbl_bit_array_2d const & | that | ) |
Copy constructor.
Definition at line 16 of file vbl_bit_array_2d.cxx.
vbl_bit_array_2d::~vbl_bit_array_2d | ( | ) | [inline] |
Definition at line 36 of file vbl_bit_array_2d.h.
void vbl_bit_array_2d::clear | ( | ) | [inline] |
make as if default-constructed.
Definition at line 55 of file vbl_bit_array_2d.h.
unsigned int vbl_bit_array_2d::cols | ( | ) | const [inline] |
Definition at line 69 of file vbl_bit_array_2d.h.
unsigned int vbl_bit_array_2d::columns | ( | ) | const [inline] |
Definition at line 70 of file vbl_bit_array_2d.h.
void vbl_bit_array_2d::construct | ( | unsigned int | m, |
unsigned int | n | ||
) | [private] |
Definition at line 88 of file vbl_bit_array_2d.cxx.
void vbl_bit_array_2d::destruct | ( | ) | [inline, private] |
Definition at line 79 of file vbl_bit_array_2d.h.
void vbl_bit_array_2d::enlarge | ( | unsigned int | m, |
unsigned int | n | ||
) |
Resizes and pads with zeros; keeps existing data.
Definition at line 46 of file vbl_bit_array_2d.cxx.
void vbl_bit_array_2d::fill | ( | bool | value | ) |
Fill with value.
Definition at line 77 of file vbl_bit_array_2d.cxx.
void vbl_bit_array_2d::flip | ( | unsigned int | i, |
unsigned int | j | ||
) | [inline] |
Change the value of a cell.
Definition at line 66 of file vbl_bit_array_2d.h.
bool vbl_bit_array_2d::get | ( | unsigned int | i, |
unsigned int | j | ||
) | const |
Definition at line 148 of file vbl_bit_array_2d.cxx.
void vbl_bit_array_2d::index | ( | unsigned int | x, |
unsigned int | y, | ||
unsigned long & | byteindex, | ||
unsigned int & | bitindex | ||
) | const [private] |
Definition at line 98 of file vbl_bit_array_2d.cxx.
bool vbl_bit_array_2d::operator!= | ( | vbl_bit_array_2d const & | a | ) | const [inline] |
Definition at line 44 of file vbl_bit_array_2d.h.
bool vbl_bit_array_2d::operator() | ( | unsigned int | i, |
unsigned int | j | ||
) | const |
Definition at line 113 of file vbl_bit_array_2d.cxx.
bool vbl_bit_array_2d::operator() | ( | unsigned int | i, |
unsigned int | j | ||
) |
Definition at line 124 of file vbl_bit_array_2d.cxx.
vbl_bit_array_2d & vbl_bit_array_2d::operator= | ( | vbl_bit_array_2d const & | that | ) |
Assignment operator.
Definition at line 35 of file vbl_bit_array_2d.cxx.
bool vbl_bit_array_2d::operator== | ( | vbl_bit_array_2d const & | a | ) | const |
Comparison.
Definition at line 106 of file vbl_bit_array_2d.cxx.
void vbl_bit_array_2d::put | ( | unsigned int | i, |
unsigned int | j, | ||
bool const & | x | ||
) |
Definition at line 135 of file vbl_bit_array_2d.cxx.
void vbl_bit_array_2d::resize | ( | unsigned int | m, |
unsigned int | n | ||
) | [inline] |
Delete contents and resize to m rows x n cols.
Definition at line 51 of file vbl_bit_array_2d.h.
unsigned int vbl_bit_array_2d::rows | ( | ) | const [inline] |
Definition at line 68 of file vbl_bit_array_2d.h.
void vbl_bit_array_2d::set | ( | unsigned int | i, |
unsigned int | j, | ||
bool | v = true |
||
) | [inline] |
Set the value of a cell; default is to set the value on.
Definition at line 64 of file vbl_bit_array_2d.h.
unsigned long vbl_bit_array_2d::size | ( | ) | const |
Number of bytes allocated by the data.
Definition at line 83 of file vbl_bit_array_2d.cxx.
unsigned char* vbl_bit_array_2d::data_ [private] |
Definition at line 75 of file vbl_bit_array_2d.h.
unsigned int vbl_bit_array_2d::num_cols_ [private] |
Definition at line 77 of file vbl_bit_array_2d.h.
unsigned int vbl_bit_array_2d::num_rows_ [private] |
Definition at line 76 of file vbl_bit_array_2d.h.