10 #ifndef RC_BITFIELD2D_H
11 #define RC_BITFIELD2D_H
30 void Initialize(
size_t new_b_size1,
size_t new_b_size2) {
31 b_size1 = new_b_size1;
32 b_size2 = new_b_size2;
52 Initialize(b_size1, b_size2);
67 return ( (b_size1 == 0) || (b_size2 == 0) );
80 return data[y*b_size1 + x];
86 return data[y*b_size1 + x];
92 return data[y*b_size1 + x];
98 return data[y*b_size1 + x];
103 inline size_t size1()
const {
return b_size1; }
105 inline size_t size2()
const {
return b_size2; }
120 data.ZeroRange(y_start, y_start + b_size1 - 1);
125 inline bool Check(
const size_t x,
const size_t y)
const {
126 if ( ! ((x < b_size1) && (y < b_size2)) ) {
136 inline void Assert(
const size_t x,
const size_t y)
const {
137 if ( !
Check(x, y) ) {
147 swap(a.data, b.data);
168 for (j=0; j<b.
size2(); j++) {
169 for (i=0; i<b.
size1(); i++) {
Provides a one-dimensional vector-like structure of packed bits.
Provides a one-dimensional vector-like structure.
Provides informative exception handling.
#define Throw_RC_Type(Type, err)
Use this to throw an RC:ErrorMsg subtype exception.
Definition: Errors.h:282
A bounds-safe two-dimensional structure of efficiently packed bits.
Definition: Bitfield2D.h:27
Bitfield2D(size_t b_size1, size_t b_size2)
Constructor which sets the initial sizes.
Definition: Bitfield2D.h:51
bool Check(const size_t x, const size_t y) const
True if indices x and y are both in bounds.
Definition: Bitfield2D.h:125
friend void swap(Bitfield2D &a, Bitfield2D &b)
Swap the data in Bitfield2D a and b.
Definition: Bitfield2D.h:144
size_t size1() const
Return the extent in bits of dimension 1.
Definition: Bitfield2D.h:103
void Delete()
Deletes the stored data, resets the sizes to 0, and releases the memory.
Definition: Bitfield2D.h:58
void Zero1D(const size_t y)
Set all bits of dimension 1 to zero at y indexed dimension 2.
Definition: Bitfield2D.h:113
bool IsEmpty() const
True if the total size of the bits is 0.
Definition: Bitfield2D.h:66
Bitfield2D()
Default constructor which initializes to size 0, 0.
Definition: Bitfield2D.h:40
void Zero()
Set all bits to 0 / false.
Definition: Bitfield2D.h:108
Bitfield::BitfieldBool operator()(size_t x, size_t y)
Bounds-checked access of the indexed element.
Definition: Bitfield2D.h:78
Bitfield::BitfieldBool At(size_t x, size_t y)
Identical to operator()
Definition: Bitfield2D.h:90
Bitfield::BitfieldBoolConst At(size_t x, size_t y) const
Const version of At()
Definition: Bitfield2D.h:96
size_t size2() const
Return the extent in bits of dimension 2.
Definition: Bitfield2D.h:105
void Assert(const size_t x, const size_t y) const
Throws ErrorMsgBounds if index x or y is out of bounds.
Definition: Bitfield2D.h:136
A temporary return-type that serves as a const interface to specific bit values.
Definition: Bitfield.h:132
A temporary return-type that serves as an interface to specific bit values.
Definition: Bitfield.h:79
A bounds-safe one-dimensional vector-like structure of efficiently packed bits.
Definition: Bitfield.h:27
std::ostream & operator<<(std::ostream &out, APtr< T > obj)
A convenience stream output for displaying the enclosed object.
Definition: APtr.h:120
void swap(RC::Data1D< T > &a, RC::Data1D< T > &b)
Efficiently swap all the contents of a and b.
Definition: Data1D.h:1184