array.hxx 3.7 KB

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