From 61627b26a0e6a1db73da994f8bd18c78cb13e7da Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 11 Jun 2016 19:40:53 +0200 Subject: [PATCH] WIP: first attempt to use a TreeMutator based binding but unfortunately this runs straight into a tough problem, which I tried to avoid and circumvent all the time: At some point, we're bound to reveal the concrete type of the Mutator -- at least to such an extent that we're able to determine the size of an allocator buffer. Moreover, by the design chosen thus far, the active TreeMutator instance (subclass) is assumed to live within the top-level of a Stack, which means that we need to place-construct it into that location. Thus, either we know the type, or we need to move it into place. --- src/lib/diff/tree-diff-mutator-binding.hpp | 15 +++-- src/lib/diff/tree-diff.hpp | 4 +- .../diff-virtualised-application-test.cpp | 18 +++--- wiki/thinkPad.ichthyo.mm | 59 ++++++++++++++++++- 4 files changed, 81 insertions(+), 15 deletions(-) diff --git a/src/lib/diff/tree-diff-mutator-binding.hpp b/src/lib/diff/tree-diff-mutator-binding.hpp index 87512dacb..815bb0bbb 100644 --- a/src/lib/diff/tree-diff-mutator-binding.hpp +++ b/src/lib/diff/tree-diff-mutator-binding.hpp @@ -410,15 +410,19 @@ namespace diff{ { open_subScope (n); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 Rec const& childRecord = child.data.get(); TRACE (diff, "tree-diff: ENTER scope %s", cStr(childRecord)); +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 } /** finish and leave child object scope, return to parent */ virtual void emu (GenNode const& n) override { +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 TRACE (diff, "tree-diff: LEAVE scope %s", cStr(describeScope())); +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 __expect_end_of_scope (n.idi); close_subScope(); @@ -427,21 +431,24 @@ namespace diff{ public: -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 explicit - DiffApplicationStrategy(Rec::Mutator& mutableTargetRecord) - : scopes_() + DiffApplicationStrategy(TreeMutator& targetBinding) { + TODO("attach to the given Target"); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 scopes_.emplace(mutableTargetRecord); +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 } void initDiffApplication() { + TODO("(re)initialise the diff application machinery"); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 REQUIRE (1 == scopes_.size()); scopes_.top().init(); - } #endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992 + } }; diff --git a/src/lib/diff/tree-diff.hpp b/src/lib/diff/tree-diff.hpp index 4c7e8259a..2ba598cf3 100644 --- a/src/lib/diff/tree-diff.hpp +++ b/src/lib/diff/tree-diff.hpp @@ -42,11 +42,11 @@ ** assumed that the receiver knows what types to expect and how to deal with them. ** - there is a notion of changing or mutating the data content, while retaining ** the identity of the element. Of course this requires the data content to be - ** assignalbe, which makes content mutation an optional feature. + ** assignable, which makes content mutation an optional feature. ** - beyond that, like in list diff, elements might be changed through a sequence of ** deletion and insertion of a changed element with the same identity. ** - since the tree like data structure is _recursive_, mutation of nested records - ** os represented by "opening" the nested record, followed by a recursive diff. + ** is represented by "opening" the nested record, followed by a recursive diff. ** By implementing the #TreeDiffInterpreter interface (visitor), a concrete usage ** can receive a diff description and possibly apply it to suitable target data. ** diff --git a/tests/library/diff/diff-virtualised-application-test.cpp b/tests/library/diff/diff-virtualised-application-test.cpp index d6f531e93..160d00789 100644 --- a/tests/library/diff/diff-virtualised-application-test.cpp +++ b/tests/library/diff/diff-virtualised-application-test.cpp @@ -23,7 +23,7 @@ #include "lib/test/run.hpp" #include "lib/format-util.hpp" -#include "lib/diff/tree-diff-application.hpp" +#include "lib/diff/tree-diff-mutator-binding.hpp" #include "lib/iter-adapter-stl.hpp" #include "lib/time/timevalue.hpp" #include "lib/format-cout.hpp" //////////TODO necessary? @@ -100,6 +100,12 @@ namespace test{ % join (nestedData_) ; } + + TreeMutator + exposeMutator() + { + UNIMPLEMENTED("find a way, how to build and expose a custom TreeMutator, without revealing details..."); + } }; }//(End)Test fixture @@ -197,13 +203,9 @@ namespace test{ virtual void run (Arg) { - /////////////////////////////TODO we need a suitable test datastructure. What follows is just placeholder code. As of 4/2016, this test waits for the completion of the TreeMutator - Opaque opa; - cout << opa < application(target); + Opaque subject; + auto target = subject.exposeMutator(); /////////////////////TODO damn it! what type can we expose here? And, we need move initialisation! + DiffApplicator application(target); // // TODO verify results cout << "before..."< - + @@ -4337,6 +4337,63 @@ + + + + + + + + + + +

+ ....man könnte später geeignete Automatismen schaffen, +

+

+ die sich diesen TreeMutator beschaffen +

+
    +
  • + indem erkannt wird, daß das eigentliche Zielobjekt ein bestimmtes API bietet +
  • +
  • + indem andere relevante Eigenschaften des Zielobjekts erkannt werden +
  • +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +