#include <bitMask.h>
Public Member Functions | |
BitMask () | |
BitMask (WordType init_value) | |
BitMask (const BitMask< WordType, num_bits > ©) | |
void | operator= (const BitMask< WordType, num_bits > ©) |
~BitMask () | |
int | get_num_bits () const |
Returns the number of bits available to set in the bitmask. | |
bool | get_bit (int index) const |
Returns true if the nth bit is set, false if it is cleared. | |
void | set_bit (int index) |
Sets the nth bit on. | |
void | clear_bit (int index) |
Sets the nth bit off. | |
void | set_bit_to (int index, bool value) |
Sets the nth bit either on or off, according to the indicated bool value. | |
bool | is_zero () const |
Returns true if the entire bitmask is zero, false otherwise. | |
WordType | extract (int low_bit, int size) const |
Returns a word that represents only the indicated range of bits within this BitMask, shifted to the least-significant position. | |
void | store (WordType value, int low_bit, int size) |
Stores the indicated word into the indicated range of bits with this BitMask. | |
WordType | get_word () const |
Returns the entire BitMask as a single word. | |
void | set_word (WordType value) |
Sets the entire BitMask to the value indicated by the given word. | |
void | invert_in_place () |
Inverts all the bits in the BitMask. | |
void | clear () |
Sets all the bits in the BitMask off. | |
void | output (ostream &out) const |
Writes the BitMask out as a binary or a hex number, according to the number of bits. | |
void | output_binary (ostream &out, int spaces_every=4) const |
Writes the BitMask out as a binary number, with spaces every four bits. | |
void | output_hex (ostream &out, int spaces_every=4) const |
Writes the BitMask out as a hexadecimal number, with spaces every four digits. | |
void | write (ostream &out, int indent_level=0) const |
Writes the BitMask out as a binary or a hex number, according to the number of bits. | |
bool | operator== (const BitMask< WordType, num_bits > &other) const |
bool | operator!= (const BitMask< WordType, num_bits > &other) const |
bool | operator< (const BitMask< WordType, num_bits > &other) const |
The ordering operator is of limited usefulness with a BitMask, however, it has a definition which places all unique BitMasks into a unique ordering. | |
int | compare_to (const BitMask< WordType, num_bits > &other) const |
Returns a number less than zero if this BitMask sorts before the indicated other BitMask, greater than zero if it sorts after, or 0 if they are equivalent. | |
BitMask< WordType, num_bits > | operator & (const BitMask< WordType, num_bits > &other) const |
BitMask< WordType, num_bits > | operator| (const BitMask< WordType, num_bits > &other) const |
BitMask< WordType, num_bits > | operator^ (const BitMask< WordType, num_bits > &other) const |
BitMask< WordType, num_bits > | operator~ () const |
BitMask< WordType, num_bits > | operator<< (int shift) const |
BitMask< WordType, num_bits > | operator>> (int shift) const |
void | operator &= (const BitMask< WordType, num_bits > &other) |
void | operator|= (const BitMask< WordType, num_bits > &other) |
void | operator^= (const BitMask< WordType, num_bits > &other) |
void | operator<<= (int shift) |
void | operator>>= (int shift) |
void | generate_hash (ChecksumHashGenerator &hashgen) const |
Adds the bitmask to the indicated hash generator. | |
Static Public Member Functions | |
BitMask< WordType, num_bits > | all_on () |
Returns a BitMask whose bits are all on. | |
BitMask< WordType, num_bits > | all_off () |
Returns a BitMask whose bits are all off. | |
BitMask< WordType, num_bits > | lower_on (int on_bits) |
Returns a BitMask whose lower num_bits bits are on. | |
BitMask< WordType, num_bits > | bit (int index) |
Returns a BitMask with only the indicated bit on. | |
TypeHandle | get_class_type () |
void | init_type () |
Private Attributes | |
WordType | _word |
Static Private Attributes | |
TypeHandle | _type_handle |
This stores an array of bits of some length that must fit within a given word of the indicated type. See also BitArray.
Definition at line 46 of file bitMask.h.
|
Definition at line 34 of file bitMask.I. References INLINE. |
|
Definition at line 48 of file bitMask.I. References INLINE. |
|
Definition at line 62 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. |
|
Definition at line 158 of file bitMask.I. References BitMask< WordType, num_bits >::_word. |
|
Returns a BitMask whose bits are all off.
|
|
Returns a BitMask whose bits are all on.
|
|
Returns a BitMask with only the indicated bit on.
Definition at line 143 of file bitMask.I. References INLINE. |
|
Sets all the bits in the BitMask off.
Definition at line 359 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. |
|
Sets the nth bit off. index must be in the range [0, get_num_bits). Definition at line 225 of file bitMask.I. References BitMask< WordType, num_bits >::_word, INLINE, and BitMask< WordType, num_bits >::lower_on(). Referenced by BitMask< WordType, num_bits >::get_bit(). |
|
Returns a number less than zero if this BitMask sorts before the indicated other BitMask, greater than zero if it sorts after, or 0 if they are equivalent. This is based on the same ordering defined by operator <. |
|
Returns a word that represents only the indicated range of bits within this BitMask, shifted to the least-significant position.
Definition at line 282 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. Referenced by BitMask< WordType, num_bits >::set_word(). |
|
Adds the bitmask to the indicated hash generator.
|
|
Returns true if the nth bit is set, false if it is cleared. index must be in the range [0, get_num_bits). Definition at line 191 of file bitMask.I. References BitMask< WordType, num_bits >::clear_bit(), INLINE, and BitMask< WordType, num_bits >::set_bit(). Referenced by BitMask< WordType, num_bits >::get_word(). |
|
|
|
Returns the number of bits available to set in the bitmask.
|
|
Returns the entire BitMask as a single word.
Definition at line 315 of file bitMask.I. References BitMask< WordType, num_bits >::get_bit(). |
|
|
|
Inverts all the bits in the BitMask.
|
|
Returns true if the entire bitmask is zero, false otherwise.
Definition at line 264 of file bitMask.I. References BitMask< WordType, num_bits >::_word. |
|
Returns a BitMask whose lower num_bits bits are on.
Definition at line 122 of file bitMask.I. Referenced by BitMask< WordType, num_bits >::clear_bit(). |
|
Definition at line 535 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. |
|
|
|
Definition at line 470 of file bitMask.I. References INLINE. |
|
The ordering operator is of limited usefulness with a BitMask, however, it has a definition which places all unique BitMasks into a unique ordering. It may be useful when defining ordered STL containers of BitMasks, for instance; and it's required in order to export any STL container (ordered or unordered) of BitMask under Windows. Definition at line 496 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. |
|
|
|
|
|
Definition at line 76 of file bitMask.I. References BitMask< WordType, num_bits >::_word. |
|
Definition at line 457 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. |
|
|
|
|
|
Definition at line 565 of file bitMask.I. References BitMask< WordType, num_bits >::_type_handle, register_type(), and ostringstream::str(). |
|
|
|
Definition at line 550 of file bitMask.I. References BitMask< WordType, num_bits >::_word, ChecksumHashGenerator::add_int(), and INLINE. |
|
|
|
|
|
Writes the BitMask out as a binary or a hex number, according to the number of bits.
Definition at line 375 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. |
|
Writes the BitMask out as a binary number, with spaces every four bits.
Definition at line 395 of file bitMask.I. References BitMask< WordType, num_bits >::_word. |
|
Writes the BitMask out as a hexadecimal number, with spaces every four digits.
Definition at line 416 of file bitMask.I. Referenced by BitMask< WordType, num_bits >::store(). |
|
Sets the nth bit on. index must be in the range [0, get_num_bits). Definition at line 208 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. Referenced by BitMask< WordType, num_bits >::get_bit(). |
|
Sets the nth bit either on or off, according to the indicated bool value. index must be in the range [0, get_num_bits). Definition at line 244 of file bitMask.I. References BitMask< WordType, num_bits >::_word, and INLINE. |
|
Sets the entire BitMask to the value indicated by the given word.
Definition at line 331 of file bitMask.I. References BitMask< WordType, num_bits >::extract(). |
|
Stores the indicated word into the indicated range of bits with this BitMask.
Definition at line 299 of file bitMask.I. References BitMask< WordType, num_bits >::output_hex(). |
|
Writes the BitMask out as a binary or a hex number, according to the number of bits.
Definition at line 444 of file bitMask.I. References INLINE. |
|
Definition at line 23 of file bitMask.I. Referenced by BitMask< WordType, num_bits >::operator^(). |
|