Lumiera  0.pre.03
»edit your freedom«
DiffDetector< SEQ > Class Template Reference

#include "lib/diff/list-diff-detector.hpp"

Description

template<class SEQ>
class lib::diff::DiffDetector< SEQ >

Detect and describe changes in a monitored data sequence.

The DiffDetector takes snapshot(s) of the observed data, to find all differences between the last snapshot and the current state. Whenever such a "List Diff" is pulled, a new baseline snapshot is taken automatically. The description of all changes can be retrieved from the returned diff iterator, as a sequence of diff verbs

Definition at line 87 of file list-diff-detector.hpp.

Public Types

using Diff = lib::IterStateWrapper< DiffStep, DiffFrame >
 Diff is a iterator to yield a sequence of DiffStep elements.
 

Public Member Functions

 DiffDetector (SEQ const &refSeq)
 
bool isChanged () const
 does the current state of the underlying sequence differ from the state embodied into the last reference snapshot taken? More...
 
Diff pullUpdate ()
 Diff generation core operation. More...
 

Classes

class  DiffFrame
 A diff generation process is built on top of an "old" reference point and a "new" state of the underlying sequence. More...
 

Private Types

using DiffStep = typename ListDiffLanguage< Val >::DiffStep
 
using Idx = IndexTable< Val >
 
using Val = typename SEQ::value_type
 

Private Attributes

SEQ const & currentData_
 
Idx refIdx_
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Function Documentation

◆ isChanged()

bool isChanged ( ) const
inline

does the current state of the underlying sequence differ from the state embodied into the last reference snapshot taken?

Remarks
will possibly evaluate and iterate the whole sequence

Definition at line 118 of file list-diff-detector.hpp.

◆ pullUpdate()

Diff pullUpdate ( )
inline

Diff generation core operation.

Take a snapshot of the current state of the underlying sequence and establish a frame to find the differences to the previously captured old state. This possible difference evaluation is embodied into a Diff iterator and handed over to the client, while the snapshot of the current state becomes the new reference point from now on.

Returns
iterator to yield a sequence of DiffStep tokens, which describe the changes between the previous reference state and the current state of the sequence.
Note
takes a new snapshot to supersede the old one, i.e. updates the DiffDetector.
Warning
the returned iterator retains a reference to the current (new) snapshot. Any concurrent modification leads to undefined behaviour. You must not invoke pullUpdate while another client still explores the result of an old evaluation.

Definition at line 147 of file list-diff-detector.hpp.

+ Inheritance diagram for DiffDetector< SEQ >:
+ Collaboration diagram for DiffDetector< SEQ >:

The documentation for this class was generated from the following file: