48 #ifndef LIB_DIFF_LIST_DIFF_DETECTOR_H 49 #define LIB_DIFF_LIST_DIFF_DETECTOR_H 81 using Val =
typename SEQ::value_type;
85 SEQ
const& currentData_;
100 , currentData_(refSeq)
111 auto snapshot = refIdx_.begin();
112 for (
auto const& elm : currentData_)
113 if (snapshot != refIdx_.end() && elm != *snapshot++)
140 Idx mark (currentData_);
141 swap (mark, refIdx_);
168 DiffStep currentStep_;
175 , currentStep_(establishNextState())
184 return token.
NIL != currentStep_;
190 REQUIRE (checkPoint());
191 return unConst(
this)->currentStep_;
197 currentStep_ = this->establishNextState();
207 return token.pick (consumeNew());
210 return token.del (consumeOld());
212 return token.ins (consumeNew());
214 return token.find (consumeNew());
216 return token.skip (consumeOld());
221 bool hasOld()
const {
return oldHead_ < old_.size(); }
222 bool hasNew()
const {
return newHead_ < new_->size(); }
223 bool canPick()
const {
return hasOld() && hasNew() && oldElm()==newElm(); }
224 bool canDelete()
const {
return hasOld() && !new_->contains(oldElm()); }
225 bool canInsert()
const {
return hasNew() && !old_.contains(newElm()); }
226 bool needFetch()
const {
return hasNew() && oldHead_ < old_.pos(newElm()); }
227 bool obsoleted()
const {
return hasOld() && newHead_ > new_->pos(oldElm()); }
229 Val
const& oldElm()
const {
return old_.getElement (oldHead_); }
230 Val
const& newElm()
const {
return new_->getElement (newHead_); }
231 Val
const& consumeOld() {
return old_.getElement (oldHead_++); }
232 Val
const& consumeNew() {
return new_->getElement (newHead_++); }
A token language to represent changes in a list of elements.
bool isChanged() const
does the current state of the underlying sequence differ from the state embodied into the last refere...
Helper template(s) for creating Lumiera Forward Iterators.
Diff pullUpdate()
Diff generation core operation.
Any copy and copy construction prohibited.
Implementation namespace for support and library code.
A diff generation process is built on top of an "old" reference point and a "new" state of the underl...
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Another Lumiera Forward Iterator building block, based on incorporating a state type as »*State Core*...
Detect and describe changes in a monitored data sequence.
Generic lookup table for a sequence of unique values.
static const DiffStep NIL
fixed "invalid" marker token
static ListDiffLanguage< Val > token
allocate static storage for the diff language token builder functions
lib::IterStateWrapper< DiffFrame > Diff
Diff is a iterator to yield a sequence of DiffStep elements.