bit_array.hxx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef BIT_ARRAY_HXX
  2. #define BIT_ARRAY_HXX
  3. #include "variable.hxx"
  4. #include "../binom_impl/ram_storage_implementation/bit_array_impl.hxx"
  5. namespace binom {
  6. class BitArray : public Variable {
  7. operator Number& () = delete;
  8. operator BufferArray& () = delete;
  9. operator Array& () = delete;
  10. operator List& () = delete;
  11. operator Map& () = delete;
  12. operator MultiMap& () = delete;
  13. operator Table& () = delete;
  14. Number& toNumber() = delete;
  15. BitArray& toBitArray() = delete;
  16. BufferArray& toBufferArray() = delete;
  17. Array& toArray() = delete;
  18. List& toList() = delete;
  19. Map& toMap() = delete;
  20. MultiMap& toMultiMap() = delete;
  21. Table& toTable() = delete;
  22. operator const Number& () const = delete;
  23. operator const BufferArray& () const = delete;
  24. operator const Array& () const = delete;
  25. operator const List& () const = delete;
  26. operator const Map& () const = delete;
  27. operator const MultiMap& () const = delete;
  28. operator const Table& () const = delete;
  29. const Number& toNumber() const = delete;
  30. const BitArray& toBitArray() const = delete;
  31. const BufferArray& toBufferArray() const = delete;
  32. const Array& toArray() const = delete;
  33. const List& toList() const = delete;
  34. const Map& toMap() const = delete;
  35. const MultiMap& toMultiMap() const = delete;
  36. const Table& toTable() const = delete;
  37. Variable& operator=(const Variable& other) = delete;
  38. Variable& operator=(Variable&& other) = delete;
  39. Variable& changeLink(const Variable& other) = delete;
  40. Variable& changeLink(Variable&& other) = delete;
  41. priv::BitArrayImplementation*& getData() const noexcept;
  42. const void* getDataPointer() const noexcept;
  43. BitArray(priv::Link&& link);
  44. friend class binom::Variable;
  45. friend class binom::KeyValue;
  46. public:
  47. typedef BitIterator Iterator;
  48. typedef BitValueRef ValueRef;
  49. typedef BitReverseIterator ReverseIterator;
  50. typedef BitConstIterator ConstIterator;
  51. typedef BitConstValueRef ConstValueRef;
  52. typedef BitConstReverseIterator ConstReverseIterator;
  53. BitArray();
  54. BitArray(const literals::bitarr bit_array);
  55. BitArray(const BitArray& other) noexcept;
  56. BitArray(const BitArray&& other) noexcept;
  57. BitArray move() noexcept;
  58. const BitArray move() const noexcept;
  59. size_t getElementCount() const noexcept;
  60. size_t getSize() const noexcept;
  61. size_t getCapacity() const noexcept;
  62. ValueRef operator[] (size_t index);
  63. const ValueRef operator[] (size_t index) const;
  64. ValueRef operator+=(bool value);
  65. Iterator operator+=(const literals::bitarr value_list);
  66. Iterator operator+=(const BitArray other);
  67. ValueRef pushBack(bool value);
  68. Iterator pushBack(const literals::bitarr value_list);
  69. ValueRef pushFront(bool value);
  70. Iterator pushFront(const literals::bitarr value_list);
  71. ValueRef insert(size_t at, bool value);
  72. Iterator insert(size_t at, const literals::bitarr value_list);
  73. void popBack(size_t size = 1);
  74. void popFront(size_t size = 1);
  75. void remove(size_t at, size_t size = 1);
  76. void clear();
  77. Iterator begin();
  78. Iterator end();
  79. ReverseIterator rbegin();
  80. ReverseIterator rend();
  81. inline ConstIterator begin() const noexcept {return cbegin();}
  82. inline ConstIterator end() const noexcept {return cend();}
  83. inline ConstReverseIterator rbegin() const noexcept {return crbegin();}
  84. inline ConstReverseIterator rend() const noexcept {return crend();}
  85. ConstIterator cbegin() const;
  86. ConstIterator cend() const;
  87. ConstReverseIterator crbegin() const;
  88. ConstReverseIterator crend() const;
  89. BitArray& operator=(const BitArray& other);
  90. BitArray& operator=(BitArray&& other);
  91. BitArray& changeLink(const BitArray& other);
  92. BitArray& changeLink(BitArray&& other);
  93. };
  94. }
  95. #endif // BIT_ARRAY_HXX