Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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
tree-diff-application.hpp
tree-diff.hpp
tree-diff-traits.hpp

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

Private Member Functions

virtual void run (Arg)
 
MutationMessage someDiff ()
 a change represented symbolically as »diff sequence«.
 
void demo_one ()
 
void demo_two ()
 
- 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 DiffVerb = VerbToken< TreeDiffInterpreter, void(GenNode const &)>
 
using DiffToken = std::tuple< DiffVerb, GenNode >
 
using Interpreter = TreeDiffInterpreter
 
- Static Private Attributes inherited from DiffLanguage< TreeDiffInterpreter, GenNode >
static const DiffStep NIL
 fixed "invalid" marker token
 

Member Function Documentation

◆ run()

virtual void run ( Arg  )
inlineprivatevirtual

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

References DiffTreeApplicationSimple_test::demo_one(), and DiffTreeApplicationSimple_test::demo_two().

+ Here is the call graph for this function:

◆ 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 114 of file diff-tree-application-simple-test.cpp.

Referenced by DiffTreeApplicationSimple_test::demo_one(), and DiffTreeApplicationSimple_test::demo_two().

+ Here is the caller graph for this function:

◆ demo_one()

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

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

References Record< VAL >::Mutator::scope(), and DiffTreeApplicationSimple_test::someDiff().

Referenced by DiffTreeApplicationSimple_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ demo_two()

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

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

References DiffApplicator< TAR >::consume(), PlantingHandle< BA, DEFAULT >::emplace(), and DiffTreeApplicationSimple_test::someDiff().

Referenced by DiffTreeApplicationSimple_test::run().

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

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