57 #ifndef LIB_DIFF_LIST_DIFF_DETECTOR_H 58 #define LIB_DIFF_LIST_DIFF_DETECTOR_H 90 using Val =
typename SEQ::value_type;
94 SEQ
const& currentData_;
109 , currentData_(refSeq)
120 auto snapshot = refIdx_.begin();
121 for (
auto const& elm : currentData_)
122 if (snapshot != refIdx_.end() && elm != *snapshot++)
149 Idx mark (currentData_);
150 swap (mark, refIdx_);
177 DiffStep currentStep_;
184 , currentStep_(establishNextState())
193 return token.
NIL != currentStep_;
199 REQUIRE (checkPoint());
200 return unConst(
this)->currentStep_;
206 currentStep_ = this->establishNextState();
216 return token.pick (consumeNew());
219 return token.del (consumeOld());
221 return token.ins (consumeNew());
223 return token.find (consumeNew());
225 return token.skip (consumeOld());
230 bool hasOld()
const {
return oldHead_ < old_.size(); }
231 bool hasNew()
const {
return newHead_ < new_->size(); }
232 bool canPick()
const {
return hasOld() && hasNew() && oldElm()==newElm(); }
233 bool canDelete()
const {
return hasOld() && !new_->contains(oldElm()); }
234 bool canInsert()
const {
return hasNew() && !old_.contains(newElm()); }
235 bool needFetch()
const {
return hasNew() && oldHead_ < old_.pos(newElm()); }
236 bool obsoleted()
const {
return hasOld() && newHead_ > new_->pos(oldElm()); }
238 Val
const& oldElm()
const {
return old_.getElement (oldHead_); }
239 Val
const& newElm()
const {
return new_->getElement (newHead_); }
240 Val
const& consumeOld() {
return old_.getElement (oldHead_++); }
241 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 right into the i...
Detect and describe changes in a monitored data sequence.
Generic lookup table for a sequence of unique values.
lib::IterStateWrapper< DiffStep, DiffFrame > Diff
Diff is a iterator to yield a sequence of DiffStep elements.
static const DiffStep NIL
fixed "invalid" marker token
static ListDiffLanguage< Val > token
allocate static storage for the diff language token builder functions