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_;
238 void set(const BitVector& bit_vector);
245 void set(const
char* bit_string);
250 BitVector& operator = (const BitVector& bit_vector);
256 BitVector& operator = (const
char *bit_string);
261 void get(BitVector& bitvector) const;
276 BitVector operator () (
Index first,
Index last) const;
283 void setSize(
Size size,
bool keep = true);
287 Size getSize() const;
293 Size countValue(
bool value) const;
298 VectorType& getBitSet();
303 const VectorType& getBitSet() 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);
445 BitVector operator | (const BitVector& bit_vector);
451 BitVector& operator |= (const BitVector& bit_vector);
458 BitVector operator & (const BitVector& bit_vector);
464 BitVector& operator &= (const BitVector& bit_vector);
471 BitVector operator ^ (const BitVector& bit_vector);
477 BitVector& operator ^= (const BitVector& bit_vector);
484 BitVector operator ~ ();
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;
533 BALL_EXPORT friend
std::istream& operator >> (
std::istream& s, BitVector& bit_vector);
538 BALL_EXPORT friend
std::ostream& operator << (
std::ostream& s, const BitVector& bit_vector);
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;
585 BlockType mask_(
Index index) const;
593 # ifndef BALL_NO_INLINE_FUNCTIONS 594 # include <BALL/DATATYPE/bitVector.iC> 599 #endif // BALL_DATATYPE_BITVECTOR_H BALL_EXPORT bool operator!=(const String &s1, const String &s2)
std::vector< BlockType > VectorType
BALL_EXPORT bool operator==(const String &s1, const String &s2)
#define BALL_CREATE(name)