18 #include "pandabase.h"
21 #include "numeric_types.h"
22 #include "typedObject.h"
24 #include "pointerToArray.h"
26 #include "checksumHashGenerator.h"
44 typedef BitMaskNative MaskType;
45 typedef MaskType::WordType WordType;
48 enum { num_bits_per_word = MaskType::num_bits };
51 INLINE BitArray(WordType init_value);
52 INLINE BitArray(
const BitArray ©);
53 INLINE BitArray &operator = (
const BitArray ©);
56 INLINE
static BitArray all_on();
57 INLINE
static BitArray all_off();
58 INLINE
static BitArray lower_on(
int on_bits);
59 INLINE
static BitArray bit(
int index);
60 INLINE
static BitArray range(
int low_bit,
int size);
64 CONSTEXPR
static bool has_max_num_bits();
65 CONSTEXPR
static int get_max_num_bits();
67 CONSTEXPR
static int get_num_bits_per_word();
68 INLINE
int get_num_bits()
const;
69 INLINE
bool get_bit(
int index)
const;
70 INLINE
void set_bit(
int index);
71 INLINE
void clear_bit(
int index);
72 INLINE
void set_bit_to(
int index,
bool value);
73 INLINE
bool get_highest_bits()
const;
75 bool is_all_on()
const;
77 INLINE WordType extract(
int low_bit,
int size)
const;
78 INLINE
void store(WordType value,
int low_bit,
int size);
79 bool has_any_of(
int low_bit,
int size)
const;
80 bool has_all_of(
int low_bit,
int size)
const;
81 void set_range(
int low_bit,
int size);
82 void clear_range(
int low_bit,
int size);
83 INLINE
void set_range_to(
bool value,
int low_bit,
int size);
85 int get_num_on_bits()
const;
86 int get_num_off_bits()
const;
87 int get_lowest_on_bit()
const;
88 int get_lowest_off_bit()
const;
89 int get_highest_on_bit()
const;
90 int get_highest_off_bit()
const;
91 int get_next_higher_different_bit(
int low_bit)
const;
93 INLINE
int get_num_words()
const;
94 INLINE MaskType get_word(
int n)
const;
95 INLINE
void set_word(
int n, WordType value);
97 void invert_in_place();
98 bool has_bits_in_common(
const BitArray &other)
const;
101 void output(ostream &out)
const;
102 void output_binary(ostream &out,
int spaces_every = 4)
const;
103 void output_hex(ostream &out,
int spaces_every = 4)
const;
104 void write(ostream &out,
int indent_level = 0)
const;
106 INLINE
bool operator == (
const BitArray &other)
const;
107 INLINE
bool operator != (
const BitArray &other)
const;
108 INLINE
bool operator < (
const BitArray &other)
const;
112 operator & (
const BitArray &other)
const;
115 operator | (
const BitArray &other)
const;
118 operator ^ (
const BitArray &other)
const;
124 operator << (
int shift)
const;
127 operator >> (
int shift)
const;
129 void operator &= (
const BitArray &other);
130 void operator |= (
const BitArray &other);
131 void operator ^= (
const BitArray &other);
132 void operator <<= (
int shift);
133 void operator >>= (
int shift);
139 INLINE
void copy_on_write();
140 void ensure_has_word(
int n);
144 typedef PTA(MaskType) Array;
156 static void init_type() {
157 register_type(_type_handle,
"BitArray");
164 #include "bitArray.I"
167 operator << (ostream &out,
const BitArray &array) {
This class records a set of integers, where each integer is either present or not present in the set...
This is a specific kind of HashGenerator that simply adds up all of the ints.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
A dynamic array with an unlimited number of bits.
void output(ostream &out) const
Writes the BitArray out as a hex number.
An STL function object class, this is intended to be used on any ordered collection of class objects ...
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...