SparseArray

Inheritance:

Methods of SparseArray:

SparseArray
SparseArray::SparseArray(void);

Description:

allOff
static SparseArray SparseArray::all_off(void);

Description: Returns a SparseArray whose bits are all off.

allOn
static SparseArray SparseArray::all_on(void);

Description: Returns a SparseArray with an infinite array of bits, all on.

bit
static SparseArray SparseArray::bit(int index);

Description: Returns a SparseArray with only the indicated bit on.

clear
void SparseArray::clear(void);

Description: Sets all the bits in the SparseArray off.

clearBit
void SparseArray::clear_bit(int index);

Description: Sets the nth bit off. If n >= get_num_bits(), this automatically extends the array.

clearRange
void SparseArray::clear_range(int low_bit, int size);

Description: Sets the indicated range of bits off.

compareTo
int SparseArray::compare_to(SparseArray const &other) const;

Description: Returns a number less than zero if this SparseArray sorts before the indicated other SparseArray, greater than zero if it sorts after, or 0 if they are equivalent. This is based on the same ordering defined by operator <.

getBit
bool SparseArray::get_bit(int index) const;

Description: Returns true if the nth bit is set, false if it is cleared. It is valid for n to increase beyond get_num_bits(), but the return value get_num_bits() will always be the same.

getClassType
static TypeHandle SparseArray::get_class_type(void);

Undocumented function.

getHighestBits
bool SparseArray::get_highest_bits(void) const;

Description: Returns true if the infinite set of bits beyond get_num_bits() are all on, or false of they are all off.

getHighestOffBit
int SparseArray::get_highest_off_bit(void) const;

Description: Returns the index of the highest 0 bit in the array. Returns -1 if there are no 0 bits or if there an infinite number of 1 bits.

getHighestOnBit
int SparseArray::get_highest_on_bit(void) const;

Description: Returns the index of the highest 1 bit in the array. Returns -1 if there are no 1 bits or if there an infinite number of 1 bits.

getLowestOffBit
int SparseArray::get_lowest_off_bit(void) const;

Description: Returns the index of the lowest 0 bit in the array. Returns -1 if there are no 0 bits or if there are an infinite number of 1 bits.

getLowestOnBit
int SparseArray::get_lowest_on_bit(void) const;

Description: Returns the index of the lowest 1 bit in the array. Returns -1 if there are no 1 bits or if there are an infinite number of 1 bits.

getMaxNumBits
static int SparseArray::get_max_num_bits(void);

Description: If get_max_num_bits() returned true, this method may be called to return the maximum number of bits that may be stored in this structure. It is an error to call this if get_max_num_bits() return false.
It is always an error to call this method. The SparseArray has no maximum number of bits. This method is defined so generic programming algorithms can use BitMask or SparseArray interchangeably.

getNextHigherDifferentBit
int SparseArray::get_next_higher_different_bit(int low_bit) const;

Description: Returns the index of the next bit in the array, above low_bit, whose value is different that the value of low_bit. Returns low_bit again if all bits higher than low_bit have the same value.
This can be used to quickly iterate through all of the bits in the array.

getNumBits
int SparseArray::get_num_bits(void) const;

Description: Returns the current number of possibly different bits in this array. There are actually an infinite number of bits, but every bit higher than this bit will have the same value, either 0 or 1 (see get_highest_bits()).
This number may grow and/or shrink automatically as needed.

getNumOffBits
int SparseArray::get_num_off_bits(void) const;

Description: Returns the number of bits that are set to 0 in the array. Returns -1 if there are an infinite number of 0 bits.

getNumOnBits
int SparseArray::get_num_on_bits(void) const;

Description: Returns the number of bits that are set to 1 in the array. Returns -1 if there are an infinite number of 1 bits.

getNumSubranges
int SparseArray::get_num_subranges(void) const;

Description: Returns the number of separate subranges stored in the SparseArray. You can use this limit to iterate through the subranges, calling get_subrange_begin() and get_subrange_end() for each one.
Also see is_inverse().

getSubrangeBegin
int SparseArray::get_subrange_begin(int n) const;

Description: Returns the first numeric element in the nth subrange.
Also see is_inverse().

getSubrangeEnd
int SparseArray::get_subrange_end(int n) const;

Description: Returns the last numeric element, plus one, in the nth subrange.
Also see is_inverse().

hasAllOf
bool SparseArray::has_all_of(int low_bit, int size) const;

Description: Returns true if all bits in the indicated range are set, false otherwise.

hasAnyOf
bool SparseArray::has_any_of(int low_bit, int size) const;

Description: Returns true if any bit in the indicated range is set, false otherwise.

hasBitsInCommon
bool SparseArray::has_bits_in_common(SparseArray const &other) const;

Description: Returns true if this SparseArray has any "one" bits in common with the other one, false otherwise.
This is equivalent to (array & other) != 0, but may be faster.

hasMaxNumBits
static bool SparseArray::has_max_num_bits(void);

Description: Returns true if there is a maximum number of bits that may be stored in this structure, false otherwise. If this returns true, the number may be queried in get_max_num_bits().
This method always returns false. The SparseArray has no maximum number of bits. This method is defined so generic programming algorithms can use BitMask or SparseArray interchangeably.

invertInPlace
void SparseArray::invert_in_place(void);

Description: Inverts all the bits in the SparseArray. This is equivalent to array = ~array.

isAllOn
bool SparseArray::is_all_on(void) const;

Description: Returns true if the entire bitmask is one, false otherwise.

isInverse
bool SparseArray::is_inverse(void) const;

Description: If this is true, the SparseArray is actually defined as a list of subranges of integers that are *not* in the set. If this is false (the default), then the subranges define the integers that *are* in the set. This affects the interpretation of the values returned by iterating through get_num_subranges().

isZero
bool SparseArray::is_zero(void) const;

Description: Returns true if the entire bitmask is zero, false otherwise.

lowerOn
static SparseArray SparseArray::lower_on(int on_bits);

Description: Returns a SparseArray whose lower on_bits bits are on.

operator !=
bool SparseArray::operator !=(SparseArray const &other) const;

Description:

operator &
SparseArray SparseArray::operator &(SparseArray const &other) const;

Description:

operator &=
void SparseArray::operator &=(SparseArray const &other);

Description:

operator <
bool SparseArray::operator <(SparseArray const &other) const;

Description: Returns true if the unsigned integer which is represented by this SparseArray is less than that of the other one, false otherwise.

operator <<
SparseArray SparseArray::operator <<(int shift) const;

Description:

operator <<=
void SparseArray::operator <<=(int shift);

Description: Logical left shift. Since negative bit positions have meaning in a SparseArray, real bit values are rotated in on the left (not necessarily zero).

operator =
SparseArray &SparseArray::operator =(SparseArray const &copy);

Description:

operator ==
bool SparseArray::operator ==(SparseArray const &other) const;

Description:

operator >>
SparseArray SparseArray::operator >>(int shift) const;

Description:

operator >>=
void SparseArray::operator >>=(int shift);

Description: Logical right shift. The rightmost bits become negative, but are not lost; they will reappear into the zero position if the array is later left-shifted.

operator ^
SparseArray SparseArray::operator ^(SparseArray const &other) const;

Description:

operator ^=
void SparseArray::operator ^=(SparseArray const &other);

Description:

operator |
SparseArray SparseArray::operator |(SparseArray const &other) const;

Description:

operator |=
void SparseArray::operator |=(SparseArray const &other);

Description:

operator ~
SparseArray SparseArray::operator ~(void) const;

Undocumented function.

output
void SparseArray::output(ostream &out) const;

Description:

range
static SparseArray SparseArray::range(int low_bit, int size);

Description: Returns a SparseArray whose size bits, beginning at low_bit, are on.

setBit
void SparseArray::set_bit(int index);

Description: Sets the nth bit on. If n >= get_num_bits(), this automatically extends the array.

setBitTo
void SparseArray::set_bit_to(int index, bool value);

Description: Sets the nth bit either on or off, according to the indicated bool value.

setRange
void SparseArray::set_range(int low_bit, int size);

Description: Sets the indicated range of bits on.

setRangeTo
void SparseArray::set_range_to(bool value, int low_bit, int size);

Description: Sets the indicated range of bits to either on or off.