Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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 78 of file list-diff-detector.hpp.

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...
 

Public Types

using Diff = lib::IterStateWrapper< 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?
 
Diff pullUpdate ()
 Diff generation core operation.
 

Private Types

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

Private Attributes

Idx refIdx_
 
SEQ const & currentData_
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ DiffDetector()

template<class SEQ >
DiffDetector ( SEQ const &  refSeq)
inlineexplicit

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

Member Typedef Documentation

◆ Val

template<class SEQ >
using Val = SEQ::value_type
private

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

◆ Idx

template<class SEQ >
using Idx = IndexTable<Val>
private

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

◆ DiffStep

template<class SEQ >
using DiffStep = ListDiffLanguage<Val>::DiffStep
private

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

◆ Diff

template<class SEQ >
using Diff = lib::IterStateWrapper<DiffFrame>

Diff is a iterator to yield a sequence of DiffStep elements.

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

Member Function Documentation

◆ isChanged()

template<class SEQ >
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 109 of file list-diff-detector.hpp.

References IndexTable< VAL >::begin(), DiffDetector< SEQ >::currentData_, IndexTable< VAL >::end(), and DiffDetector< SEQ >::refIdx_.

+ Here is the call graph for this function:

◆ pullUpdate()

template<class SEQ >
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 138 of file list-diff-detector.hpp.

References DiffDetector< SEQ >::currentData_, and DiffDetector< SEQ >::refIdx_.

Member Data Documentation

◆ refIdx_

template<class SEQ >
Idx refIdx_
private

◆ currentData_

template<class SEQ >
SEQ const& currentData_
private
+ Inheritance diagram for DiffDetector< SEQ >:
+ Collaboration diagram for DiffDetector< SEQ >:

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