Tools.h++ Manual
104011 Tandem Computers Incorporated 21-25
21
Public constructors
RWBitVec();
Construct a zero lengthed (null) vector.
RWBitVec(size_t N);
Construct a vector with
N
bits. The initial value of the bits is undefined.
RWBitVec(size_t N, RWBoolean initVal);
Construct a vector with
N
bits, each set to the Boolean value
initVal
.
RWBitVec(const RWByte* bp, size_t N);
Construct a vector with
N
bits, initialized to the data in the array of bytes
pointed to by
bp
. This array must be at least long enough to contain
N
bits.
The identifier
RWByte
is a typedef for an unsigned char.
RWBitVec(const RWBitVec& v);
Copy constructor. Uses value semantics—the constructed vector will be a copy
of
v
.
~RWBitVec();
The destructor. Releases any allocated memory.
Assignment operators
RWBitVec& operator=(const RWBitVec& v);
Assignment operator. Value semantics are used—self will be a copy of
v
.
RWBitVec& operator=(RWBoolean b);
Assignment operator. Sets every bit in self to the boolean value
b
.
RWBitVec& operator&=(const RWBitVec& v);
RWBitVec& operator^=(const RWBitVec& v);
RWBitVec& operator|=(const RWBitVec& v);
Logical assignments. Set each element of self to the logical AND, XOR, or OR,
respectively, of self and the corresponding bit in
v
. Self and
v
must have the
same number of elements (i.e., be conformal) or an exception of type
RWInternalErr
will occur.
Indexing operators
RWBitRef operator[](size_t i);
Returns a reference to bit
i
of self. A helper class,
RWBitRef
, is used. The
result can be used as an lvalue. The index
i
must be between 0 and the length
of the vector less one. Bounds checking is performed. If the index is out of
range, then an exception of type
RWBoundsErr
will occur.