123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #ifndef CORE_BIT_ARRAY_H
- #define CORE_BIT_ARRAY_H
- #include "utils/Check.h"
- #include "utils/String.h"
- namespace Core {
- class BitArray final {
- int length;
- int bits;
- int* data;
- public:
- BitArray();
- BitArray(const BitArray& other) = delete;
- BitArray(BitArray&& other);
- ~BitArray();
- BitArray& operator=(const BitArray& other) = delete;
- BitArray& operator=(BitArray&& other);
- // returns true on error
- check_return bool copyFrom(const BitArray& other);
- BitArray& set(int index, int value);
- int get(int index) const;
- int getLength() const;
- int getBits() const;
- int getInternalByteSize() const;
- int select(int index) const;
- // returns true on error
- check_return bool resize(int newLength, int newBits);
- void fill(int value);
- void toString(String& s) const;
- private:
- void swap(BitArray& other);
- };
- }
- #endif
|