41 typedef BitMaskNative MaskType;
42 typedef MaskType::WordType WordType;
45 enum { num_bits_per_word = MaskType::num_bits };
48 INLINE
BitArray(WordType init_value);
53 INLINE
static BitArray lower_on(
int on_bits);
54 INLINE
static BitArray bit(
int index);
55 INLINE
static BitArray range(
int low_bit,
int size);
57 constexpr
static bool has_max_num_bits() {
return false; }
58 constexpr
static int get_max_num_bits() {
return INT_MAX; }
60 constexpr
static int get_num_bits_per_word() {
return num_bits_per_word; }
61 INLINE
size_t get_num_bits()
const;
62 INLINE
bool get_bit(
int index)
const;
63 INLINE
void set_bit(
int index);
64 INLINE
void clear_bit(
int index);
65 INLINE
void set_bit_to(
int index,
bool value);
66 INLINE
bool get_highest_bits()
const;
68 bool is_all_on()
const;
70 INLINE WordType extract(
int low_bit,
int size)
const;
71 INLINE
void store(WordType value,
int low_bit,
int size);
72 bool has_any_of(
int low_bit,
int size)
const;
73 bool has_all_of(
int low_bit,
int size)
const;
74 void set_range(
int low_bit,
int size);
75 void clear_range(
int low_bit,
int size);
76 INLINE
void set_range_to(
bool value,
int low_bit,
int size);
78 int get_num_on_bits()
const;
79 int get_num_off_bits()
const;
81 int get_lowest_off_bit()
const;
83 int get_highest_off_bit()
const;
84 int get_next_higher_different_bit(
int low_bit)
const;
86 INLINE
size_t get_num_words()
const;
87 INLINE MaskType get_word(
size_t n)
const;
88 INLINE
void set_word(
size_t n, WordType value);
90 void invert_in_place();
91 bool has_bits_in_common(
const BitArray &other)
const;
94 void output(std::ostream &out)
const;
95 void output_binary(std::ostream &out,
int spaces_every = 4)
const;
96 void output_hex(std::ostream &out,
int spaces_every = 4)
const;
97 void write(std::ostream &out,
int indent_level = 0)
const;
99 INLINE
bool operator == (
const BitArray &other)
const;
100 INLINE
bool operator != (
const BitArray &other)
const;
101 INLINE
bool operator < (
const BitArray &other)
const;
105 operator & (
const BitArray &other)
const;
108 operator | (
const BitArray &other)
const;
111 operator ^ (
const BitArray &other)
const;
117 operator << (
int shift)
const;
120 operator >> (
int shift)
const;
122 void operator &= (
const BitArray &other);
123 void operator |= (
const BitArray &other);
124 void operator ^= (
const BitArray &other);
125 void operator <<= (
int shift);
126 void operator >>= (
int shift);
132 INLINE
void copy_on_write();
133 void ensure_has_word(
int n);
137 typedef PTA(MaskType) Array;
149 static void init_type() {
159 INLINE std::ostream &
160 operator << (std::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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
int get_lowest_on_bit(uint16_t x)
Returns the index of the lowest 1 bit in the word.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void output(std::ostream &out) const
Writes the BitArray out as a hex number.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A dynamic array with an unlimited number of bits.
int get_highest_on_bit(uint16_t x)
Returns the index of the highest 1 bit in the word.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.