42 typedef BitMaskNative MaskType;
43 typedef MaskType::WordType WordType;
46 enum { num_bits_per_word = MaskType::num_bits };
49 INLINE
BitArray(WordType init_value);
54 INLINE
static BitArray lower_on(
int on_bits);
55 INLINE
static BitArray bit(
int index);
56 INLINE
static BitArray range(
int low_bit,
int size);
58 constexpr static bool has_max_num_bits() {
return false; }
59 constexpr static int get_max_num_bits() {
return INT_MAX; }
61 constexpr static int get_num_bits_per_word() {
return num_bits_per_word; }
62 INLINE
size_t get_num_bits()
const;
63 INLINE
bool get_bit(
int index)
const;
64 INLINE
void set_bit(
int index);
65 INLINE
void clear_bit(
int index);
66 INLINE
void set_bit_to(
int index,
bool value);
67 INLINE
bool get_highest_bits()
const;
69 bool is_all_on()
const;
71 INLINE WordType extract(
int low_bit,
int size)
const;
72 INLINE
void store(WordType value,
int low_bit,
int size);
73 bool has_any_of(
int low_bit,
int size)
const;
74 bool has_all_of(
int low_bit,
int size)
const;
75 void set_range(
int low_bit,
int size);
76 void clear_range(
int low_bit,
int size);
77 INLINE
void set_range_to(
bool value,
int low_bit,
int size);
79 int get_num_on_bits()
const;
80 int get_num_off_bits()
const;
82 int get_lowest_off_bit()
const;
84 int get_highest_off_bit()
const;
85 int get_next_higher_different_bit(
int low_bit)
const;
87 INLINE
size_t get_num_words()
const;
88 INLINE MaskType get_word(
size_t n)
const;
89 INLINE
void set_word(
size_t n, WordType value);
91 void invert_in_place();
92 bool has_bits_in_common(
const BitArray &other)
const;
95 void output(std::ostream &out)
const;
96 void output_binary(std::ostream &out,
int spaces_every = 4)
const;
97 void output_hex(std::ostream &out,
int spaces_every = 4)
const;
98 void write(std::ostream &out,
int indent_level = 0)
const;
100 INLINE
bool operator == (
const BitArray &other)
const;
101 INLINE
bool operator != (
const BitArray &other)
const;
102 INLINE
bool operator < (
const BitArray &other)
const;
106 operator & (
const BitArray &other)
const;
109 operator | (
const BitArray &other)
const;
112 operator ^ (
const BitArray &other)
const;
118 operator << (
int shift)
const;
121 operator >> (
int shift)
const;
123 void operator &= (
const BitArray &other);
124 void operator |= (
const BitArray &other);
125 void operator ^= (
const BitArray &other);
126 void operator <<= (
int shift);
127 void operator >>= (
int shift);
129 EXTENSION(PyObject *__getstate__()
const);
130 EXTENSION(
void __setstate__(PyObject *state));
136 INLINE
void copy_on_write();
137 void ensure_has_word(
int n);
141 typedef PTA(MaskType) Array;
155 static void init_type() {
166operator << (std::ostream &out,
const BitArray &array) {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
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(std::ostream &out) const
Writes the BitArray out as a hex number.
This is a specific kind of HashGenerator that simply adds up all of the ints.
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
The default class template does not define any methods.
This class records a set of integers, where each integer is either present or not present in the set.
TypeHandle is the identifier used to differentiate C++ class types.
An STL function object class, this is intended to be used on any ordered collection of class objects ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_highest_on_bit(unsigned short x)
Returns the index of the highest 1 bit in the word.
int get_lowest_on_bit(unsigned short x)
Returns the index of the lowest 1 bit in the word.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.