multi_map.hxx 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef MULTI_MAP_HXX
  2. #define MULTI_MAP_HXX
  3. #include "../binom_impl/ram_storage_implementation/multi_map_impl.hxx"
  4. namespace binom {
  5. class MultiMap : public Variable {
  6. operator Number& () = delete;
  7. operator BitArray& () = delete;
  8. operator BufferArray& () = delete;
  9. operator Array& () = delete;
  10. operator List& () = delete;
  11. operator Map& () = delete;
  12. operator Table& () = delete;
  13. Number& toNumber() = delete;
  14. BitArray& toBitArray() = delete;
  15. BufferArray& toBufferArray() = delete;
  16. Array& toArray() = delete;
  17. List& toList() = delete;
  18. Map& toMap() = delete;
  19. Table& toTable() = delete;
  20. operator const Number& () const = delete;
  21. operator const BitArray& () const = delete;
  22. operator const BufferArray& () const = delete;
  23. operator const Array& () const = delete;
  24. operator const List& () const = delete;
  25. operator const Map& () const = delete;
  26. operator const Table& () const = delete;
  27. const Number& toNumber() const = delete;
  28. const BitArray& toBitArray() const = delete;
  29. const BufferArray& toBufferArray() const = delete;
  30. const Array& toArray() const = delete;
  31. const List& toList() const = delete;
  32. const Map& toMap() const = delete;
  33. const Table& toTable() const = delete;
  34. Variable& operator=(const Variable& other) = delete;
  35. Variable& operator=(Variable&& other) = delete;
  36. Variable& changeLink(const Variable& other) = delete;
  37. Variable& changeLink(Variable&& other) = delete;
  38. friend class priv::TableImplementation;
  39. priv::MultiMapImplementation* getData();
  40. const priv::MultiMapImplementation* getData() const;
  41. friend class Variable;
  42. MultiMap(priv::Link&& link);
  43. friend class priv::TableImplementation;
  44. friend class index::Field;
  45. Error addTable(priv::TableImplementation& table);
  46. Error removeTable(priv::TableImplementation& table);
  47. bool updateKey(index::Field& field, const KeyValue& new_key);
  48. public:
  49. // using NamedVariable = binom::priv::MultiMapImplementation::NamedVariable;
  50. typedef priv::MultiMapImplementation::Iterator Iterator;
  51. typedef priv::MultiMapImplementation::ReverseIterator ReverseIterator;
  52. typedef priv::MultiMapImplementation::ConstIterator ConstIterator;
  53. typedef priv::MultiMapImplementation::ConstReverseIterator ConstReverseIterator;
  54. MultiMap();
  55. MultiMap(literals::multimap multimap_elements);
  56. MultiMap(const MultiMap& other);
  57. MultiMap(MultiMap&& other);
  58. MultiMap move() noexcept;
  59. const MultiMap move() const noexcept;
  60. void clear();
  61. bool isEmpty() const noexcept;
  62. size_t getElementCount() const noexcept;
  63. bool contains(KeyValue key) const noexcept;
  64. err::ProgressReport<FieldRef> insert(KeyValue key, Variable variable, NewNodePosition position = NewNodePosition::back);
  65. Error remove(Iterator it);
  66. Error remove(ReverseIterator it);
  67. Error removeAll(KeyValue key);
  68. err::ProgressReport<FieldRef> rename(Iterator it, KeyValue new_key);
  69. std::pair<Iterator, Iterator> getRange(KeyValue key);
  70. std::pair<ReverseIterator, ReverseIterator> getReverseRange(KeyValue key);
  71. std::pair<ConstIterator, ConstIterator> getRange(KeyValue key) const;
  72. std::pair<ConstReverseIterator, ConstReverseIterator> getReverseRange(KeyValue key) const;
  73. Iterator find(KeyValue key);
  74. ReverseIterator rfind(KeyValue key);
  75. Iterator findLast(KeyValue key);
  76. ReverseIterator rfindLast(KeyValue key);
  77. ConstIterator find(KeyValue key) const;
  78. ConstReverseIterator rfind(KeyValue key) const;
  79. ConstIterator findLast(KeyValue key) const;
  80. ConstReverseIterator rfindLast(KeyValue key) const;
  81. Iterator operator[](KeyValue key) noexcept;
  82. ConstIterator operator[](KeyValue key) const noexcept;
  83. Iterator begin();
  84. Iterator end();
  85. ReverseIterator rbegin();
  86. ReverseIterator rend();
  87. ConstIterator begin() const noexcept;
  88. ConstIterator end() const noexcept;
  89. ConstReverseIterator rbegin() const noexcept;
  90. ConstReverseIterator rend() const noexcept;
  91. ConstIterator cbegin() const noexcept;
  92. ConstIterator cend() const noexcept;
  93. ConstReverseIterator crbegin() const noexcept;
  94. ConstReverseIterator crend() const noexcept;
  95. MultiMap& operator=(const MultiMap& other);
  96. MultiMap& operator=(MultiMap&& other);
  97. MultiMap& changeLink(const MultiMap& other);
  98. MultiMap& changeLink(MultiMap&& other);
  99. };
  100. }
  101. #endif // MULTI_MAP_HXX