Ditto 4.11.1
 
Loading...
Searching...
No Matches
ditto::Differ Class Reference

Calculates diffs between arrays of QueryResultItem elements. More...

Public Member Functions

 Differ ()
 Constructor.
 
 Differ (const Differ &)=delete
 
Differoperator= (const Differ &)=delete
 
 Differ (Differ &&)=default
 
Differoperator= (Differ &&)=default
 
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 differ.
 

Detailed Description

Calculates diffs between arrays of QueryResultItem elements.

Use a Differ with a StoreObserver to get the diff between subsequent query results delivered by the store observer.

Member Function Documentation

◆ diff()

ditto::Diff ditto::Differ::diff ( const std::vector< QueryResultItem > & items)

Calculate the diff of the provided items against the last set of items that were passed to this differ.

The returned Diff identifies changes from the old array of items to the new array of items using indices into both arrays.

Initially, the differ has no items, so the first call to this method will always return a diff showing all items as insertions.

The identity of items is determined by their _id field.

Parameters
itemsThe query result items to compare against the last array of items.