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.
This commit is contained in:
parent
37f4caf7be
commit
61627b26a0
4 changed files with 81 additions and 15 deletions
|
|
@ -410,15 +410,19 @@ namespace diff{
|
|||
{
|
||||
open_subScope (n);
|
||||
|
||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #992
|
||||
Rec const& childRecord = child.data.get<Rec>();
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
**
|
||||
|
|
|
|||
|
|
@ -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 <<endl;
|
||||
|
||||
Rec::Mutator target;
|
||||
Rec& subject = target;
|
||||
DiffApplicator<Rec::Mutator> application(target);
|
||||
Opaque subject;
|
||||
auto target = subject.exposeMutator(); /////////////////////TODO damn it! what type can we expose here? And, we need move initialisation!
|
||||
DiffApplicator<TreeMutator> application(target);
|
||||
//
|
||||
// TODO verify results
|
||||
cout << "before..."<<endl << subject<<endl;
|
||||
|
|
|
|||
|
|
@ -4323,7 +4323,7 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1465428839332" ID="ID_909803930" MODIFIED="1465428899833" TEXT="Diff-Anwendung">
|
||||
<node CREATED="1465428839332" ID="ID_909803930" MODIFIED="1465665730709" TEXT="Diff-Anwendung" VSHIFT="36">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1465428850946" ID="ID_1085608480" MODIFIED="1465428866278">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
|
|
@ -4337,6 +4337,63 @@
|
|||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<node CREATED="1465664755169" ID="ID_132124444" MODIFIED="1465664761884" TEXT="Modus der Anwendung">
|
||||
<node CREATED="1465664762944" ID="ID_1254081914" MODIFIED="1465665479208" TEXT="DiffApplicator<TreeMutator>">
|
||||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
<node CREATED="1465664777398" ID="ID_872861883" MODIFIED="1465664864246" TEXT="Automatismen sind denkbar">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
....man könnte später geeignete Automatismen schaffen,
|
||||
</p>
|
||||
<p>
|
||||
die sich diesen TreeMutator beschaffen
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
indem erkannt wird, daß das eigentliche Zielobjekt ein bestimmtes API bietet
|
||||
</li>
|
||||
<li>
|
||||
indem andere relevante Eigenschaften des Zielobjekts erkannt werden
|
||||
</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node CREATED="1465665483456" ID="ID_1329468559" MODIFIED="1465665491378" TEXT="Problem: konkreter Mutator">
|
||||
<node CREATED="1465665492727" ID="ID_743684748" MODIFIED="1465665500210" TEXT="muß vom Target gebaut werden"/>
|
||||
<node CREATED="1465665500830" ID="ID_937213383" MODIFIED="1465665561681" TEXT="Typ nicht bekannt">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
<node CREATED="1465665511580" ID="ID_611347489" MODIFIED="1465665556325" TEXT="soll auf Stack top-Level ">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1465665579587" ID="ID_786565560" MODIFIED="1465665589851" TEXT="problematisch">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1465665594969" ID="ID_1072421347" MODIFIED="1465665614258" TEXT="unbekannte Größe">
|
||||
<node CREATED="1465665884698" ID="ID_418230667" MODIFIED="1465665893757" TEXT="default-Buffergöße vorlegen"/>
|
||||
<node CREATED="1465665894273" ID="ID_970277186" MODIFIED="1465665901124" TEXT="Größe proben und anpassen"/>
|
||||
<node CREATED="1465665901640" ID="ID_650164559" MODIFIED="1465665920298" TEXT="Größe für "bekannte" Targets statisch hinterlegen"/>
|
||||
</node>
|
||||
<node CREATED="1465665614990" ID="ID_1851089586" MODIFIED="1465665618569" TEXT="verwirrendes API">
|
||||
<node CREATED="1465665980686" ID="ID_1537039073" MODIFIED="1465665991232" TEXT="Anwendung sollte selbstevident sein"/>
|
||||
<node CREATED="1465666009690" ID="ID_1006664389" MODIFIED="1465666034048" TEXT="Typ-Signatur sollte den Weg weisen"/>
|
||||
<node CREATED="1465665993012" ID="ID_1531461875" MODIFIED="1465666003750" TEXT="keine komplexen "Riten""/>
|
||||
<node CREATED="1465666524573" HGAP="30" ID="ID_462712191" MODIFIED="1465666537889" TEXT="Schlußfolgerung" VSHIFT="18">
|
||||
<icon BUILTIN="yes"/>
|
||||
<node CREATED="1465666541419" ID="ID_1090547868" MODIFIED="1465666552293" TEXT="entweder ein festes Interface"/>
|
||||
<node CREATED="1465666552842" ID="ID_1518882587" MODIFIED="1465666574594" TEXT="oder über Metaprogrammierung / Spezialisierung"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1465428871136" ID="ID_1015843161" MODIFIED="1465428881634" TEXT="integration mehrerer Bindungs-Layer"/>
|
||||
<node CREATED="1465428882150" ID="ID_1889489833" MODIFIED="1465428890897" TEXT="komplexer Integrationstest"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue