6 #ifndef KAGOME_STORAGE_MAP_CURSOR_HPP 7 #define KAGOME_STORAGE_MAP_CURSOR_HPP 21 template <
typename K,
typename V,
typename KView = K>
29 virtual outcome::result<bool>
seekFirst() = 0;
35 virtual outcome::result<bool>
seek(
const KView &
key) = 0;
41 virtual outcome::result<bool>
seekLast() = 0;
48 virtual bool isValid()
const = 0;
53 virtual outcome::result<void>
next() = 0;
59 virtual std::optional<K>
key()
const = 0;
65 virtual std::optional<V>
value()
const = 0;
70 #endif // KAGOME_STORAGE_MAP_CURSOR_HPP An abstraction over generic map cursor.
virtual std::optional< V > value() const =0
Getter for value of the element currently pointed at.
virtual std::optional< K > key() const =0
Getter for the key of the element currently pointed at.
virtual ~MapCursor()=default
virtual outcome::result< void > next()=0
Make step forward.
virtual bool isValid() const =0
Is the cursor in a valid state?
virtual outcome::result< bool > seekFirst()=0
Same as std::begin(...);.
virtual outcome::result< bool > seek(const KView &key)=0
Find given key and seek iterator to this key.
virtual outcome::result< bool > seekLast()=0
Same as std::rbegin(...);, e.g. points to the last valid element.