Go to the documentation of this file.
28 #ifndef CASA_BITVECTOR_H
29 #define CASA_BITVECTOR_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/Containers/Block.h>
34 #include <casacore/casa/Utilities/Assert.h>
35 #include <casacore/casa/iosfwd.h>
40 class BitVectorHelper;
269 operator Bool()
const;
309 : bitNumber_p (bitNumber),
319 : bitNumber_p (that.bitNumber_p),
320 vecPtr_p (that.vecPtr_p)
329 inline BitVectorHelper::operator
Bool()
const
331 return vecPtr_p->getBit (bitNumber_p);
337 vecPtr_p->putBit (bitNumber_p, that.vecPtr_p->getBit (that.bitNumber_p));
Helper class for BitVector.
void set(Bool state)
Set all bits of the bit vector to the specified state.
BitVector * vecPtr_p
Pointer back to the original vector.
Bool operator==(const BitVector &that) const
Returns True if all bits are equal.
friend ostream & operator<<(ostream &, const BitVector &vector)
Write a representation of the bit vector (a list of zeros and ones enclosed in square parentheses) to...
uInt nbits() const
Return the number of bits in the bitvector.
BitVector(uInt length, Bool state)
Create a bit vector with length bits and set all bits to to the specified state.
BitVector()
Create a bit vector of length 0.
void operator^=(const BitVector &that)
BitVector operator&(const BitVector &that) const
Logical operations on whole bit vectors.
Bool toggleBit(uInt pos)
Toggle a bit at the given position (0-relative).
Bool operator!=(const BitVector &that) const
Returns True if a bit differs.
const uInt WORDSIZE
The size of a unsigned Integer (assumes 8-bit char)
~BitVector()
Delete the bit vector.
Bool operator[](uInt pos) const
Index operator to access the specified bit.
Bool getBit(uInt pos) const
Get a bit at the given position (0-relative).
#define DebugAssert(expr, exception)
void resize(uInt length, Bool state=False, Bool copy=True)
Resize the bit vector to the new length.
void copy(uInt thisStart, uInt length, const BitVector &that, uInt thatStart)
Copy length bits starting at thatStart in the other BitVector to this BitVector starting at thisStart...
void setBit(uInt pos)
Set a bit at the given position (0-relative).
void operator&=(const BitVector &that)
Logical in-place operations on whole bit vectors.
void operator|=(const BitVector &that)
BitVector operator~() const
this file contains all the compiler specific defines
BitVector operator^(const BitVector &that) const
void set(uInt start, uInt length, Bool state)
Set length bits starting at the start position (0-relative) to the given state.
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
BitVector & operator=(const BitVector &that)
Assignment (copy semantics).
const BitVectorHelper & operator=(const BitVectorHelper &that) const
Set the bit to the state of the bit in the other BitVector.
friend class BitVectorHelper
BitVectorHelper is a helper class.
BitVector operator|(const BitVector &that) const
uInt size_p
Number of bits in the BitVector object.
void clearBit(uInt pos)
Clear a bit at the given position (0-relative).
bool Bool
Define the standard types used by Casacore.
BitVectorHelper(const BitVectorHelper &that)
Copy constructor has to be public.
Block< uInt > bits_p
Pointer to the actual bit vector, stored as a contiguous sequence of one or more unsigned integers.
BitVector(const BitVector &that)
Copy constructor (copy semantics).
void putBit(uInt pos, Bool state)
Set a bit at the given position (0-relative) to the given state.