5 #ifndef BALL_DATATYPE_BITVECTOR_H
6 #define BALL_DATATYPE_BITVECTOR_H
12 #ifndef BALL_CONCEPT_PERSISTENCEMANAGER_H
16 #ifndef BALL_COMMON_EXCEPTION_H
23 #define BALL_BLOCK_BITS 8
24 #define BALL_BLOCK_MASK (BALL_BLOCK_BITS - 1)
25 #define BALL_BLOCK_SHIFT 3
26 #define BALL_BLOCK_ALL_BITS_SET 0xFF
27 #define BALL_BLOCK_ALL_BITS_CLEARED 0x00
30 #define BALL_BLOCK_SIZE(bits) (Size)(((bits) + BALL_BLOCK_BITS - 1) >> BALL_BLOCK_SHIFT)
104 operator bool()
const;
114 Bit& operator = (
const Bit& bit);
122 Bit& operator = (
const bool bit);
126 virtual void clear();
163 bool bitvector_muteable_;
245 void set(const
char* bit_string);
256 BitVector& operator = (const
char *bit_string);
283 void setSize(
Size size,
bool keep = true);
287 Size getSize() const;
293 Size countValue(
bool value) const;
319 bool operator [] (
Index index) const;
330 void setBit(
Index index,
bool value = true);
340 bool getBit(
Index index);
350 bool getBit(
Index index) const;
358 void toggleBit(
Index index);
368 void fill(
bool value = true,
Index first = 0 ,
Index last = -1);
378 void toggle(
Index first = 0,
Index last = -1);
384 void setUnsignedChar(
unsigned char bit_pattern);
390 unsigned char getUnsignedChar() const;
395 void setUnsignedShort(
unsigned short bit_pattern);
400 unsigned short getUnsignedShort() const;
405 void setUnsignedInt(
unsigned int bit_pattern);
410 unsigned int getUnsignedInt() const;
415 void setUnsignedLong(
unsigned long bit_pattern);
420 unsigned long getUnsignedLong() const;
426 void bitwiseOr(const
BitVector& bit_vector);
432 void bitwiseXor(const
BitVector& bit_vector);
438 void bitwiseAnd(const
BitVector& bit_vector);
492 bool operator == (const
BitVector& bit_vector) const;
495 bool operator != (const
BitVector& bit_vector) const;
504 bool isAnyBit(
bool value,
Index first = 0,
Index last = -1) const;
513 bool isEveryBit(
bool value,
Index first = 0,
Index last = -1) const;
522 bool isValid() const;
543 virtual
void read(std::istream& s);
547 virtual
void write(std::ostream& s) const;
564 void validateIndex_(
Index& index);
568 void validateIndex_(
Index& index) const;
572 void validateRange_(
Index& first,
Index& last) const;
593 # ifndef BALL_NO_INLINE_FUNCTIONS
594 # include <BALL/DATATYPE/bitVector.iC>
599 #endif // BALL_DATATYPE_BITVECTOR_H