4#include "QueryResult.hpp"
18using IndexSet = std::set<std::size_t>;
55 Move &operator=(
const Move &other) =
default;
57 Move &operator=(
Move &&other) =
default;
63 bool operator!=(
const Move &other)
const {
return !(*
this == other); }
65 bool operator<(
const Move &other)
const {
66 return from < other.from || (
from == other.from &&
to < other.to);
103 std::vector<Move>
moves)
112 explicit Diff(
const nlohmann::json &json);
116 Diff &operator=(
const Diff &other) =
default;
118 Diff &operator=(
Diff &&other) =
default;
139 std::shared_ptr<dittoffi_differ_t> ffi_differ;
169 Diff diff(
const std::vector<QueryResultItem> &items);
Diff diff(const std::vector< QueryResultItem > &items)
Calculate the diff of the provided items against the last set of items that were passed to this diffe...
Definition Differ.cpp:44
Differ()
Constructor.
Definition Differ.cpp:39
Representation of a move from one index to another in a vector.
Definition Differ.hpp:33
std::size_t from
The index in the old array from which the item has been moved.
Definition Differ.hpp:37
std::size_t to
The index in the new array to which the item has been moved.
Definition Differ.hpp:42
Move()
Default constructor.
Definition Differ.hpp:52
Move(std::size_t from, std::size_t to)
Constructor with initial values.
Definition Differ.hpp:47
Represents differences between two arrays of items.
Definition Differ.hpp:26
IndexSet insertions
The set of indexes in the new array at which the new items have been inserted.
Definition Differ.hpp:74
Diff()=default
Default constructor.
IndexSet updates
The set of indexes in the new array at which the items have been updated.
Definition Differ.hpp:86
IndexSet deletions
The set of indexes in the old array at which the items have been deleted.
Definition Differ.hpp:80
std::vector< Move > moves
A set of objects each representing a move of an item from a particular index in the old array to a pa...
Definition Differ.hpp:92
Diff(IndexSet insertions, IndexSet deletions, IndexSet updates, std::vector< Move > moves)
Constructor with initial values.
Definition Differ.hpp:102
bool operator==(const Diff &other) const
Test for equality between two diffs.
Definition Differ.cpp:28
bool operator!=(const Diff &other) const
Test for inequality between two diffs.
Definition Differ.cpp:33