Lumiera  0.pre.03
»edityourfreedom«
TreeDiffInterpreter Class Referenceabstract

#include "lib/diff/tree-diff.hpp"

Description

Interpreter interface to define the operations ("verbs"), which describe differences or changes in hierarchical data structure.

The meaning of the verbs is as follows:

  • ins prompts to insert the given argument element at the current processing position into the target sequence. This operation allows to inject new data
  • del requires to delete the next element at current position. For sake of verification, the ID of the argument payload is required to match the ID of the element about to be discarded.
  • pick just accepts the next element at current position into the resulting altered sequence. Again, the ID of the argument has to match the ID of the element to be picked, for sake of verification.
  • find effect a re-ordering of the target scope contents: it requires to search for the (next respective single occurrence of the) given element further down into the remainder of the current record scope (but not into nested child scopes). The designated element is to be retrieved and inserted as the next element at current position.
  • skip processing hint, emitted at the position where an element previously extracted by a find verb happened to sit within the old order. This allows an optimising implementation to “fetch” a copy and just drop or skip the original, thereby avoiding to shift any other elements.
  • after shortcut to pick existing elements up to the designated point. As a special notation, after(Ref::ATTRIBUTES) allows to fast forward to the first child element, while after(Ref::END) means to accept all of the existing data contents as-is (presumably to append further elements beyond that point).
  • set assign a new value to the element designated element. This is primarily intended for primitive data values and requires the payload type to be assignable, without changing the element's identity. The element is identified by the payload's ID and needs to be present already, i.e. it has to be mentioned by preceding order defining verbs (the list diff verbs, pick, or find).
  • mut bracketing construct to open a nested sub scope, for mutation. The element designated by the ID of the argument needs to be a Recordnested child object"". Moreover, this element must have been mentioned with the preceding diff verbs at that level, which means that the element as such must already be present in the altered target structure. The mut(ID) verb then opens this nested record for diff handling, and all subsequent diff verbs are to be interpreted relative to this scope, until the corresponding emu(ID) verb is encountered.
  • emu bracketing construct and counterpart to mut(ID). This verb must be given precisely at the end of the nested scope (it is not allowed to "return" from the middle of a scope, for sake of sanity). At this point, this child scope is left and the parent scope with all existing diff state is popped from an internal stack

Definition at line 133 of file tree-diff.hpp.

Public Types

using Val = GenNode
 

Public Member Functions

virtual ~TreeDiffInterpreter ()
 this is an interface More...
 
virtual void after (GenNode const &n)=0
 
virtual void del (GenNode const &n)=0
 
virtual void emu (GenNode const &n)=0
 
virtual void find (GenNode const &n)=0
 
virtual void ins (GenNode const &n)=0
 
virtual void mut (GenNode const &n)=0
 
virtual void pick (GenNode const &n)=0
 
virtual void set (GenNode const &n)=0
 
virtual void skip (GenNode const &n)=0
 

Member Typedef Documentation

◆ Val

using Val = GenNode

Definition at line 136 of file tree-diff.hpp.

Constructor & Destructor Documentation

◆ ~TreeDiffInterpreter()

virtual ~TreeDiffInterpreter ( )
inlinevirtual

this is an interface

Definition at line 138 of file tree-diff.hpp.

References TreeDiffInterpreter::after(), TreeDiffInterpreter::del(), TreeDiffInterpreter::emu(), TreeDiffInterpreter::find(), TreeDiffInterpreter::ins(), TreeDiffInterpreter::mut(), TreeDiffInterpreter::pick(), and TreeDiffInterpreter::skip().

+ Here is the call graph for this function:

Member Function Documentation

◆ ins()

virtual void ins ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

Referenced by TreeDiffInterpreter::~TreeDiffInterpreter().

+ Here is the caller graph for this function:

◆ del()

virtual void del ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

Referenced by TreeDiffInterpreter::~TreeDiffInterpreter().

+ Here is the caller graph for this function:

◆ pick()

virtual void pick ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

Referenced by TreeDiffInterpreter::~TreeDiffInterpreter().

+ Here is the caller graph for this function:

◆ find()

virtual void find ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

Referenced by TreeDiffInterpreter::~TreeDiffInterpreter().

+ Here is the caller graph for this function:

◆ skip()

virtual void skip ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

Referenced by TreeDiffInterpreter::~TreeDiffInterpreter().

+ Here is the caller graph for this function:

◆ after()

virtual void after ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

Referenced by TreeDiffInterpreter::~TreeDiffInterpreter().

+ Here is the caller graph for this function:

◆ set()

virtual void set ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

◆ mut()

virtual void mut ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

Referenced by TreeDiffInterpreter::~TreeDiffInterpreter().

+ Here is the caller graph for this function:

◆ emu()

virtual void emu ( GenNode const &  n)
pure virtual

Implemented in TreeDiffMutatorBinding.

Referenced by TreeDiffInterpreter::~TreeDiffInterpreter().

+ Here is the caller graph for this function:
+ Inheritance diagram for TreeDiffInterpreter:
+ Collaboration diagram for TreeDiffInterpreter:

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