Lumiera  0.pre.03
»edit your freedom«
DiffTreeApplicationSimple_test Class Reference

Description

Test:
Demonstration/Concept: apply a "tree diff" to reshape structured data.
  • the demo_one() constructs a "GenNode object", which is then mutated by applying a diff.
  • the demo_two() uses a STL collection (vector) as opaque data structure, establishes a diff binding to that structure and then applies basically the same diff to mutate the target data.
    Remarks
    This test is meant as introductory example to explain the meaning of the terms "diff", "diff verbs", "application", "mutation", "target data" and thus to show the basic ideas of Lumiera's »Diff Framework«. As can be expected, these examples are somewhat artificial and everything is made up as to look simple, while deliberately a lot of technical intricacies will be swept under the carpet.
    See also
    DiffTreeApplication_test extended demonstration of possible diff operations
    DiffComplexApplication_test handling arbitrary data structures
    GenericRecord_test
    GenNode_test
    DiffListApplication_test
    diff-tree-application.hpp
    tree-diff.hpp
    tree-diff-traits.hpp

Definition at line 101 of file diff-tree-application-simple-test.cpp.

Private Member Functions

void demo_one ()
 
void demo_two ()
 
virtual void run (Arg)
 
MutationMessage someDiff ()
 a change represented symbolically as »diff sequence«. More...
 
- Private Member Functions inherited from TreeDiffLanguage
 DiffStep_CTOR (ins)
 
 DiffStep_CTOR (del)
 
 DiffStep_CTOR (pick)
 
 DiffStep_CTOR (find)
 
 DiffStep_CTOR (skip)
 
 DiffStep_CTOR (after)
 
 DiffStep_CTOR (set)
 
 DiffStep_CTOR (mut)
 
 DiffStep_CTOR (emu)
 

Additional Inherited Members

- Private Types inherited from TreeDiffLanguage
using Interpreter = TreeDiffInterpreter
 
- Private Types inherited from DiffLanguage< TreeDiffInterpreter, GenNode >
using DiffToken = std::tuple< DiffVerb, GenNode >
 
using DiffVerb = VerbToken< TreeDiffInterpreter, void(GenNode const &)>
 
using Interpreter = TreeDiffInterpreter
 
- Static Private Attributes inherited from DiffLanguage< TreeDiffInterpreter, GenNode >
static const DiffStep NIL
 fixed "invalid" marker token More...
 

Member Function Documentation

◆ someDiff()

MutationMessage someDiff ( )
inlineprivate

a change represented symbolically as »diff sequence«.

This is a sequence of verbs to describe what should be done in order to mutate the target data. This example can be read as

  • first accept an existing element "a" as-is
  • after that insert a new element "d" into the sequence
  • next delete an existing element "b" from the sequence
  • and finally accept an existing element "c" into the result

Definition at line 123 of file diff-tree-application-simple-test.cpp.

◆ demo_one()

void demo_one ( )
inlineprivate
Test:
mutate a Record<GenNode> by applying the sample diff

Definition at line 135 of file diff-tree-application-simple-test.cpp.

◆ demo_two()

void demo_two ( )
inlineprivate
Test:
mutate a STL collection opaquely by applying the sample diff

Definition at line 150 of file diff-tree-application-simple-test.cpp.

+ Inheritance diagram for DiffTreeApplicationSimple_test:
+ Collaboration diagram for DiffTreeApplicationSimple_test:

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