Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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. More...
 

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 ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
 ~NonCopyable ()=default
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Typedef Documentation

using Val = typename SEQ::value_type
private

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

using Idx = IndexTable<Val>
private

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

using DiffStep = typename ListDiffLanguage<Val>::DiffStep
private

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

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

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

Constructor & Destructor Documentation

DiffDetector ( SEQ const &  refSeq)
inlineexplicit

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

Member Function Documentation

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.

References IndexTable< VAL >::begin(), IndexTable< VAL >::end(), and lib::iter_stl::snapshot().

+ Here is the call graph for this function:

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.

Member Data Documentation

Idx refIdx_
private

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

SEQ const& currentData_
private

Definition at line 94 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: