Lumiera  0.pre.03
DiffApplicationStrategy< TAR, enable_if< TreeDiffTraits< TAR > > > Class Template Reference

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


template<class TAR>
class lib::diff::DiffApplicationStrategy< TAR, enable_if< TreeDiffTraits< TAR > > >

Interpreter for the tree-diff-language to work on arbitrary opaque target data structures.

A concrete strategy to apply a structural diff to otherwise undisclosed, recursive, tree-like target data. The only requirement is for this target structure to expose a hook for building a customised TreeMutator able to work on and transform the private target data.

This generic setup for diff application covers especially the case where the target data is a "GenNode tree", and the root is accessible as Rec::Mutator (We use the Mutator as entry point, since GenNode trees are by default immutable).

In the extended configuration for tree-diff-application to given opaque target data, the setup uses the metaprogramming adapter traits to pave a way for building the custom TreeMutator implementation, wired internally to the given opaque target. Moreover, based on the concrete target type, a suitable ScopeManager implementation can be provided. Together, these two dynamically created adapters allow the generic TreeDiffMutatorBinding to perform all of the actual diff application and mutation task.

lumiera::error::Statewhen diff application fails due to the target sequence being different than assumed by the given diff.
See also
DiffComplexApplication_test usage example of this combined machinery
#TreeDiffInterpreter explanation of the verbs

Definition at line 349 of file tree-diff-application.hpp.

Public Member Functions

 DiffApplicationStrategy (TAR &subject)
void initDiffApplication ()
- Public Member Functions inherited from TreeDiffMutatorBinding
 TreeDiffMutatorBinding ()
- Public Member Functions inherited from TreeDiffInterpreter
virtual ~TreeDiffInterpreter ()
 this is an interface More...

Private Types

using Scopes = StackScopeManager< TreeMutatorSizeTraits< TAR >::siz >

Private Member Functions

TreeMutatorbuildMutator (DiffMutable &targetBinding)

Private Attributes

Scopes scopes_
TAR & subject_

Additional Inherited Members

- Public Types inherited from TreeDiffInterpreter
using Val = GenNode
- Protected Attributes inherited from TreeDiffMutatorBinding

Member Typedef Documentation

◆ Scopes

using Scopes = StackScopeManager<TreeMutatorSizeTraits<TAR>::siz>

Definition at line 352 of file tree-diff-application.hpp.

Constructor & Destructor Documentation

◆ DiffApplicationStrategy()

DiffApplicationStrategy ( TAR &  subject)

Definition at line 370 of file tree-diff-application.hpp.

Member Function Documentation

◆ buildMutator()

TreeMutator* buildMutator ( DiffMutable targetBinding)

Definition at line 360 of file tree-diff-application.hpp.

References DiffMutable::buildMutator(), StackScopeManager< buffSiz >::clear(), PlantingHandle< BA >::get(), and StackScopeManager< buffSiz >::openScope().

+ Here is the call graph for this function:

◆ initDiffApplication()

void initDiffApplication ( )

Definition at line 377 of file tree-diff-application.hpp.

References StackScopeManager< buffSiz >::currentScope(), lib::diff::mutatorBinding(), TreeDiffMutatorBinding::scopeManger_, and TreeDiffMutatorBinding::treeMutator_.

+ Here is the call graph for this function:

Member Data Documentation

◆ subject_

TAR& subject_

Definition at line 355 of file tree-diff-application.hpp.

◆ scopes_

Scopes scopes_

Definition at line 356 of file tree-diff-application.hpp.

+ Inheritance diagram for DiffApplicationStrategy< TAR, enable_if< TreeDiffTraits< TAR > > >:
+ Collaboration diagram for DiffApplicationStrategy< TAR, enable_if< TreeDiffTraits< TAR > > >:

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