Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Compare two data sequences to find or describe differences.
The DiffDetector defined here takes snapshot(s) from a monitored generic data structure and generates a description of differences in a linearised list diff language. Once initiated, the investigation of the old and new sequence snapshot, combined with generation of a sequence of diff description verbs, proceeds demand driven. The client "takes" a DiffFrame, which acts as iterator to extract the diff progressively; when initiating such a diff generation process, a new baseline snapshot from the underlying data is taken to replace the old baseline.
The implementation is built using a simplistic method and is certainly far from optimal. For one, we're taking snapshots, and we're building an index table for each snapshot, in order to distinguish inserted and deleted elements from mismatches due to sequence re-ordering. And for the description of permutations, we use a processing pattern similar to insertion sort. This allows for a very simple generation mechanism, but requires the receiver of the diff to scan down into the remainder of the data to find and fetch elements out-of-order.
Definition in file list-diff-detector.hpp.
#include "lib/diff/list-diff.hpp"
#include "lib/diff/index-table.hpp"
#include "lib/iter-adapter.hpp"
#include "lib/nocopy.hpp"
#include <utility>
Classes | |
class | DiffDetector< SEQ > |
Detect and describe changes in a monitored data sequence. More... | |
class | DiffDetector< SEQ >::DiffFrame |
A diff generation process is built on top of an "old" reference point and a "new" state of the underlying sequence. More... | |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |