#include <BitSet.h++>

Classes | |
| class | Bit |
| A "reference" to a bit within a BitSet. More... | |
Public Member Functions | |
| BitSet (uint_t size) | |
| Construct a new BitSet of the given size. | |
| BitSet (const BitSet &other) | |
| Copy constructor. | |
| BitSet (const String &bits) | |
| Construct a BitSet from a String. | |
| virtual | ~BitSet () throw () |
| Destructor. | |
| BitSet & | set (uint_t pos, bool value=true) throw () |
| Set (or clear) a bit at the given position. | |
| BitSet & | setRange (uint_t startPos, uint_t endPos, bool value=true) throw () |
| Set (or clear) the bits in the given (inclusive) range. | |
| BitSet & | setAll (bool value=true) throw () |
| Set (or clear) all of the bits in the BitSet. | |
| BitSet & | clear (uint_t pos) throw () |
| Clear the bit at the given position. | |
| BitSet & | clearRange (uint_t startPos, uint_t endPos) throw () |
| Clear the bits in the given (inclusive) range. | |
| BitSet & | clearAll () throw () |
| Clear all of the bits in the BitSet. | |
| bool | isSet (uint_t pos) const throw () |
| Test if a bit at the given position is set. | |
| bool | get (uint_t pos) const throw () |
| Get the value of the bit at the given position. | |
| bool | isClear (uint_t pos) const throw () |
| Test if a bit at the given position is clear. | |
| bool | isAnySet () const throw () |
| Test if at least one bit is set in the BitSet. | |
| bool | isAllSet () const throw () |
| Test if all of the bits are set in the BitSet. | |
| bool | isAllClear () const throw () |
| Test if all of the bits are clear in the BitSet. | |
| int | nextSetBit (uint_t startPos) const throw () |
| Find the index of the next bit that is set, beginning at the given position. | |
| int | firstSetBit () const throw () |
| Find the index of the first bit that is set. | |
| int | nextClearBit (uint_t startPos) const throw () |
| Find the index of the next bit that is clear, beginning at the given position. | |
| int | firstClearBit () const throw () |
| Find the index of the first bit that is clear. | |
| bool | operator! () const throw () |
| Test if all of the bits in the BitSet are cleared. | |
| BitSet & | flip () throw () |
| Flip (toggle) all of the bits in the BitSet. | |
| BitSet & | flip (uint_t pos) throw (OutOfBoundsException) |
| Flip (toggle) the bit at the given position. | |
| void | swap (BitSet &other) throw (OutOfBoundsException) |
| Swap the bits of this BitSet with those of another. | |
| Bit | operator[] (uint_t pos) throw (OutOfBoundsException) |
| Obtain a "reference" to a bit at the given position. | |
| bool | operator[] (uint_t pos) const throw () |
| Get the value of a bit at the given position. | |
| uint_t | getSize () const throw () |
| Get the size of the BitSet, in bits. | |
| size_t | getWordCount () const throw () |
| Get the number of words in the BitSet. | |
| uint32_t | getWord (uint_t index) const throw () |
| Get the word at the specified index in the BitSet. | |
| uint32_t | getWordDiff (uint_t index, uint32_t other) const throw () |
| "Diff" the word at the specificed index in the BitSet against another word. | |
| void | setWord (uint_t index, uint32_t word) throw () |
| Set the word at the specified index in the BitSet. | |
| String | toString () const |
| Get a String representation of the BitSet. | |
| void | write (std::ostream &stream) const |
| Write a string representation of the BitSet to a stream. | |
| bool | operator== (const BitSet &other) const throw () |
| Equality operator. | |
| bool | operator!= (const BitSet &other) const throw () |
| Inequality operator. | |
| BitSet & | operator= (const BitSet &other) |
| Assignment operator. | |
| BitSet & | operator|= (const BitSet &other) throw (OutOfBoundsException) |
| Bitwise OR assignment operator. | |
| BitSet & | operator&= (const BitSet &other) throw (OutOfBoundsException) |
| Bitwise AND assignment operator. | |
| BitSet & | operator^= (const BitSet &other) throw (OutOfBoundsException) |
| Bitwise XOR assignment operator. | |
| BitSet & | operator>>= (size_t n) throw () |
| Bitwise right-shift assignment operator. | |
| BitSet & | operator<<= (size_t n) throw () |
| Bitwise left-shift assignment operator. | |
| BitSet | operator>> (size_t n) const |
| Bitwise right-shift operator. | |
| BitSet | operator<< (size_t n) const |
| Bitwise left-shift operator. | |
| BitSet | operator~ () const throw () |
| Bitwise NOT operator. | |
The bits are stored internally in an array of words, each word being a 32-bit unsigned integer that represents 32 boolean values. Complete words can be fetched if the caller needs efficient access to multiple bits at a time.
Construct a BitSet from a String.
| bits | A String consisting of only the characters '0' and '1'; any other characters will be interpreted as 0. |
| ~BitSet | ( | ) | throw () [virtual] |
Destructor.
Clear the bit at the given position.
| pos | The position. |
Clear the bits in the given (inclusive) range.
| startPos | The start position of the range. | |
| endPos | The end position of the range. |
| int firstClearBit | ( | ) | const throw () [inline] |
Find the index of the first bit that is clear.
| int firstSetBit | ( | ) | const throw () [inline] |
Find the index of the first bit that is set.
| BitSet & flip | ( | uint_t | pos | ) | throw (OutOfBoundsException) |
Flip (toggle) the bit at the given position.
| OutOfBoundsException | If the position is invalid. |
| bool get | ( | uint_t | pos | ) | const throw () [inline] |
Get the value of the bit at the given position.
| uint_t getSize | ( | ) | const throw () [inline] |
| uint32_t getWord | ( | uint_t | index | ) | const throw () [inline] |
Get the word at the specified index in the BitSet.
| index | The index. If the index is out of range, a value of 0 is returned. |
| size_t getWordCount | ( | ) | const throw () [inline] |
Get the number of words in the BitSet.
(Each word is a 32-bit integer.)
| uint32_t getWordDiff | ( | uint_t | index, | |
| uint32_t | other | |||
| ) | const throw () [inline] |
"Diff" the word at the specificed index in the BitSet against another word.
Essentially, this function simply returns a bitwise XOR of the two words.
| index | The index. If the index is out of range, a value of 0 is returned. | |
| other | The other word to "diff" against. |
| bool isAllClear | ( | ) | const throw () [inline] |
Test if all of the bits are clear in the BitSet.
| bool isAllSet | ( | ) | const throw () |
Test if all of the bits are set in the BitSet.
| bool isAnySet | ( | ) | const throw () |
Test if at least one bit is set in the BitSet.
| bool isClear | ( | uint_t | pos | ) | const throw () [inline] |
Test if a bit at the given position is clear.
| bool isSet | ( | uint_t | pos | ) | const throw () |
Test if a bit at the given position is set.
| int nextClearBit | ( | uint_t | startPos | ) | const throw () [inline] |
Find the index of the next bit that is clear, beginning at the given position.
| startPos | The starting bit position to search from. |
| int nextSetBit | ( | uint_t | startPos | ) | const throw () [inline] |
Find the index of the next bit that is set, beginning at the given position.
| startPos | The starting bit position to search from. |
| bool operator! | ( | ) | const throw () [inline] |
Test if all of the bits in the BitSet are cleared.
Equivalent to isAllClear().
| bool operator!= | ( | const BitSet & | other | ) | const throw () [inline] |
Inequality operator.
| BitSet & operator&= | ( | const BitSet & | other | ) | throw (OutOfBoundsException) |
Bitwise AND assignment operator.
| OutOfBoundsException | If the two BitSets are not of equal size. |
| BitSet operator<< | ( | size_t | n | ) | const [inline] |
| BitSet & operator<<= | ( | size_t | n | ) | throw () |
Bitwise left-shift assignment operator.
| n | The number of bit positions by which to shift the BitSet. |
| bool operator== | ( | const BitSet & | other | ) | const throw () |
Equality operator.
| BitSet operator>> | ( | size_t | n | ) | const [inline] |
| BitSet & operator>>= | ( | size_t | n | ) | throw () |
Bitwise right-shift assignment operator.
| n | The number of bit positions by which to shift the BitSet. |
| bool operator[] | ( | uint_t | pos | ) | const throw () [inline] |
Get the value of a bit at the given position.
| pos | The position. |
| BitSet::Bit operator[] | ( | uint_t | pos | ) | throw (OutOfBoundsException) |
Obtain a "reference" to a bit at the given position.
| pos | The position. |
| OutOfBoundsException | If the position is invalid. |
| BitSet & operator^= | ( | const BitSet & | other | ) | throw (OutOfBoundsException) |
Bitwise XOR assignment operator.
| OutOfBoundsException | If the two BitSets are not of equal size. |
| BitSet & operator|= | ( | const BitSet & | other | ) | throw (OutOfBoundsException) |
Bitwise OR assignment operator.
| OutOfBoundsException | If the two BitSets are not of equal size. |
| BitSet operator~ | ( | ) | const throw () [inline] |
Set (or clear) a bit at the given position.
| pos | The position of the bit. | |
| value | The value to set the bit to. |
| BitSet & setAll | ( | bool | value = true |
) | throw () |
Set (or clear) all of the bits in the BitSet.
| value | The value to set all of the bits to. |
Set (or clear) the bits in the given (inclusive) range.
| startPos | The start position of the range. | |
| endPos | The end position of the range. | |
| value | The value to set the bits to. |
| void setWord | ( | uint_t | index, | |
| uint32_t | word | |||
| ) | throw () |
Set the word at the specified index in the BitSet.
| index | The index. If the index is out of range, the method has no effect. | |
| word | The word. |
| void swap | ( | BitSet & | other | ) | throw (OutOfBoundsException) |
Swap the bits of this BitSet with those of another.
| OutOfBoundsException | If both BitSets are not of equal size. |
| void write | ( | std::ostream & | stream | ) | const |
Write a string representation of the BitSet to a stream.
1.5.9