23 #ifndef __ccxx_BitSet_hxx 24 #define __ccxx_BitSet_hxx 60 Bit& operator=(
const Bit& other);
63 Bit& operator=(
bool val);
69 operator bool()
const;
125 BitSet& setAll(
bool value =
true);
133 {
return(
set(pos,
false)); }
142 {
return(setRange(startPos, endPos,
false)); }
146 {
return(setAll(
false)); }
149 bool isSet(
int pos)
const;
153 {
return(isSet(pos)); }
157 {
return(! isSet(pos)); }
160 bool isAnySet()
const;
163 bool isAllSet()
const;
167 {
return(! isAnySet()); }
178 {
return(_nextBit(startPos,
true)); }
187 {
return(_nextBit(0,
true)); }
198 {
return(_nextBit(startPos,
false)); }
207 {
return(_nextBit(0,
false)); }
214 {
return(! isAnySet()); }
240 Bit operator[](
int pos);
250 {
return(isSet(pos)); }
271 {
return(index >= _length ? 0 : _words[index]); }
284 {
return(getWord(index) ^ other); }
293 void setWord(
uint_t index, uint32_t word);
299 void write(std::ostream &stream)
const;
306 {
return(!
operator==(other)); }
353 {
return(
BitSet(*
this) >>= n); }
362 {
return(
BitSet(*
this) <<= n); }
375 int _nextBit(
uint_t startPos,
bool set)
const;
391 #endif // __ccxx_BitSet_hxx
int firstSetBit() const
Find the index of the first bit that is set.
Definition: BitSet.h++:186
bool operator!=(const BitSet &other) const
Inequality operator.
Definition: BitSet.h++:305
void swap(ScopedPtr< T > &a, ScopedPtr< T > &b)
Swap two ScopedPtr values.
Definition: ScopedPtr.h++:133
uint_t getWordCount() const
Get the number of words in the BitSet.
Definition: BitSet.h++:260
int nextSetBit(uint_t startPos) const
Find the index of the next bit that is set, beginning at the given position.
Definition: BitSet.h++:177
BitSet & clearAll()
Clear all of the bits in the BitSet.
Definition: BitSet.h++:145
uint_t getSize() const
Get the size of the BitSet, in bits.
Definition: BitSet.h++:253
bool isClear(uint_t pos) const
Test if a bit at the given position is clear.
Definition: BitSet.h++:156
int nextClearBit(uint_t startPos) const
Find the index of the next bit that is clear, beginning at the given position.
Definition: BitSet.h++:197
uint32_t getWordDiff(uint_t index, uint32_t other) const
"Diff" the word at the specificed index in the BitSet against another word.
Definition: BitSet.h++:283
bool operator==(const Blob &b1, const Blob &b2)
Definition: Blob.h++:344
unsigned int uint_t
An alias for unsigned int.
Definition: Integers.h++:74
A compact representation of an array of bits (boolean values).
Definition: BitSet.h++:42
BitSet & clearRange(uint_t startPos, uint_t endPos)
Clear the bits in the given (inclusive) range.
Definition: BitSet.h++:141
uint32_t getWord(uint_t index) const
Get the word at the specified index in the BitSet.
Definition: BitSet.h++:270
std::ostream & operator<<(std::ostream &stream, const BitSet &bs)
Definition: BitSet.h++:383
#define COMMONCPP_API
Definition: Common.h++:126
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
Definition: String.h++:50
A "reference" to a bit within a BitSet.
Definition: BitSet.h++:50
bool operator!() const
Test if all of the bits in the BitSet are cleared.
Definition: BitSet.h++:213
bool operator[](int pos) const
Get the value of a bit at the given position.
Definition: BitSet.h++:249
void write(std::ostream &stream) const
Write a string representation of the BitSet to a stream.
Definition: BitSet.c++:549
BitSet operator<<(uint_t n) const
Bitwise left-shift operator.
Definition: BitSet.h++:361
BitSet operator>>(uint_t n) const
Bitwise right-shift operator.
Definition: BitSet.h++:352
BitSet & clear(uint_t pos)
Clear the bit at the given position.
Definition: BitSet.h++:132
Definition: AllocationMap.c++:25
bool isAllClear() const
Test if all of the bits are clear in the BitSet.
Definition: BitSet.h++:166
BitSet operator~() const
Bitwise NOT operator.
Definition: BitSet.h++:369
int firstClearBit() const
Find the index of the first bit that is clear.
Definition: BitSet.h++:206
BitSet & flip()
Flip (toggle) all of the bits in the BitSet.
Definition: BitSet.c++:292