map.hxx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef MAP_HXX
  2. #define MAP_HXX
  3. #include "../binom_impl/ram_storage_implementation/map_impl.hxx"
  4. #include "field.hxx"
  5. namespace binom {
  6. class Map : public Variable {
  7. operator Number& () = delete;
  8. operator BitArray& () = delete;
  9. operator BufferArray& () = delete;
  10. operator Array& () = delete;
  11. operator List& () = 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 BitArray& () const = delete;
  24. operator const BufferArray& () const = delete;
  25. operator const Array& () const = delete;
  26. operator const List& () 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::MapImplementation* getData();
  42. const priv::MapImplementation* getData() const;
  43. friend class Variable;
  44. Map(priv::Link&& link);
  45. friend class priv::TableImplementation;
  46. friend class index::Field;
  47. Error addTable(priv::TableImplementation& table);
  48. Error removeTable(priv::TableImplementation& table);
  49. bool updateKey(index::Field& field, const KeyValue& new_key);
  50. public:
  51. // using FieldRef = binom::index::FieldRef;
  52. typedef priv::MapImplementation::Iterator Iterator;
  53. typedef priv::MapImplementation::ReverseIterator ReverseIterator;
  54. typedef priv::MapImplementation::ConstIterator ConstIterator;
  55. typedef priv::MapImplementation::ConstReverseIterator ConstReverseIterator;
  56. Map();
  57. Map(literals::map element_list);
  58. Map(const Map& other);
  59. Map(Map&& other);
  60. Map move() noexcept;
  61. const Map move() const noexcept;
  62. bool isEmpty() const noexcept;
  63. size_t getElementCount() const noexcept;
  64. bool contains(KeyValue value) const noexcept;
  65. void clear();
  66. err::ProgressReport<FieldRef> insert(KeyValue key, Variable variable);
  67. err::Error remove(KeyValue key);
  68. err::ProgressReport<FieldRef> rename(KeyValue old_key, KeyValue new_key);
  69. Variable getVariable(KeyValue key);
  70. const Variable getVariable(KeyValue key) const;
  71. FieldRef getField(KeyValue key);
  72. const FieldRef getField(KeyValue key) const;
  73. FieldRef operator[] (KeyValue key);
  74. const FieldRef operator[] (KeyValue key) const;
  75. Iterator find(KeyValue key);
  76. ReverseIterator rfind(KeyValue key);
  77. ConstIterator find(KeyValue key) const;
  78. ConstReverseIterator rfind(KeyValue key) const;
  79. Iterator begin();
  80. Iterator end();
  81. ReverseIterator rbegin();
  82. ReverseIterator rend();
  83. ConstIterator begin() const noexcept;
  84. ConstIterator end() const noexcept;
  85. ConstReverseIterator rbegin() const noexcept;
  86. ConstReverseIterator rend() const noexcept;
  87. ConstIterator cbegin() const noexcept;
  88. ConstIterator cend() const noexcept;
  89. ConstReverseIterator crbegin() const noexcept;
  90. ConstReverseIterator crend() const noexcept;
  91. Map& operator=(const Map& other);
  92. Map& operator=(Map&& other);
  93. Map& changeLink(const Map& other);
  94. Map& changeLink(Map&& other);
  95. };
  96. }
  97. #endif // MAP_HXX