#ifndef CORE_BIT_ARRAY_HPP #define CORE_BIT_ARRAY_HPP #include "core/utils/ArrayString.hpp" namespace Core { class BitArray final { u64 lengthBits; u64* data; public: BitArray(); BitArray(const BitArray& other) = delete; BitArray(BitArray&& other); ~BitArray(); BitArray& operator=(const BitArray& other) = delete; BitArray& operator=(BitArray&& other); check_return Error copyFrom(const BitArray& other); BitArray& set(u64 index, u64 value); u64 get(u64 index) const; u64 getLength() const; u64 getBits() const; u64 getInternalByteSize() const; i64 select(u64 index) const; check_return Error resize(u64 newLength, u64 newBits); void fill(u64 value); template check_return Error toString(String& s) const { CORE_RETURN_ERROR(s.append("[")); u64 length = getLength(); if(length > 0) { length--; for(u64 i = 0; i < length; i++) { CORE_RETURN_ERROR(s.append(get(i))); CORE_RETURN_ERROR(s.append(", ")); } CORE_RETURN_ERROR(s.append(get(length))); } return s.append("]"); } void swap(BitArray& other); }; } #endif