From 5aa41accfced6705c7375cfb807e53c3f07df771 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 2 May 2021 18:31:47 +0200 Subject: [PATCH] Lib/Diff: prefer the name "emplace" over "build" ...for the operation on a PlantingHandle, which allows to implant a sub type instance into the opaque buffer. * "create" should be used for a constructor invocation * "emplace" takes an existing object and move-constructs --- src/lib/diff/test-mutation-target.hpp | 2 +- src/lib/diff/tree-diff.cpp | 2 +- .../diff/tree-mutator-collection-binding.hpp | 12 +- src/lib/diff/tree-mutator-noop-binding.hpp | 2 +- src/lib/opaque-holder.hpp | 4 +- src/stage/ctrl/notification-hub.hpp | 2 +- src/stage/interact/interaction-director.cpp | 2 +- src/stage/setting/asset-controller.cpp | 2 +- src/stage/timeline/clip-presenter.hpp | 2 +- src/stage/timeline/marker-widget.cpp | 2 +- src/stage/timeline/ruler-track.cpp | 2 +- src/stage/timeline/timeline-controller.cpp | 2 +- src/stage/timeline/timeline-gui.cpp | 2 +- src/stage/timeline/track-presenter.hpp | 2 +- .../diff/diff-complex-application-test.cpp | 2 +- .../library/diff/diff-ignore-changes-test.cpp | 6 +- .../diff-tree-application-simple-test.cpp | 2 +- .../diff/diff-tree-mutation-listener-test.cpp | 2 +- .../diff/tree-mutator-binding-test.cpp | 4 +- tests/stage/test/mock-elm.hpp | 2 +- wiki/thinkPad.ichthyo.mm | 166 +++++++++++++++++- 21 files changed, 192 insertions(+), 32 deletions(-) diff --git a/src/lib/diff/test-mutation-target.hpp b/src/lib/diff/test-mutation-target.hpp index 0b97a3896..01ab27cb6 100644 --- a/src/lib/diff/test-mutation-target.hpp +++ b/src/lib/diff/test-mutation-target.hpp @@ -514,7 +514,7 @@ namespace diff{ Iter targetElm = target_.locate (spec.idi); if (targetElm) { - targetBuff.create (TreeMutator::build()); + targetBuff.emplace (TreeMutator::build()); target_.logMutation (*targetElm); return true; } diff --git a/src/lib/diff/tree-diff.cpp b/src/lib/diff/tree-diff.cpp index c9fd23782..c5ee09a16 100644 --- a/src/lib/diff/tree-diff.cpp +++ b/src/lib/diff/tree-diff.cpp @@ -74,7 +74,7 @@ namespace diff{ void Record::Mutator::buildMutator (BufferHandle buff) { - buff.create ( + buff.emplace ( TreeMutator::build() .attach (*this)); } diff --git a/src/lib/diff/tree-mutator-collection-binding.hpp b/src/lib/diff/tree-mutator-collection-binding.hpp index 22731c404..015a2a292 100644 --- a/src/lib/diff/tree-mutator-collection-binding.hpp +++ b/src/lib/diff/tree-mutator-collection-binding.hpp @@ -474,7 +474,17 @@ namespace diff{ } /** locate the designated target element and build a suitable - * sub-mutator for this element into the provided target buffer */ + * sub-mutator for this element into the provided target buffer. + * @remark basically we just delegate the implementation to the lambda + * provided as "mutator" `MUT` to the CollectionBinding instance, which + * in turn was created by the TreeMutator builder-DSL. However, in practice, + * the most relevant implementation will be the _default implementation,_ which + * recursively forwards this invocation again to the DiffMutable::buildMutator() + * virtual function, which then is implemented on each actual "diff mutable" UI-Element. + * This default implementation can be found in tree-mutator-diffmutable-binding.cpp, + * within the `struct _DefaultBinding` (at the bottom of the file). Typically the + * concrete implementation will invoke `targetBuff.emplant( TreeMutator::build() ...)` + * @see stage::timeline::TimelineController::buildMutator (TreeMutator::Handle) */ virtual bool mutateChild (GenNode const& spec, TreeMutator::Handle targetBuff) override { diff --git a/src/lib/diff/tree-mutator-noop-binding.hpp b/src/lib/diff/tree-mutator-noop-binding.hpp index 192ad7c8c..ca362d03d 100644 --- a/src/lib/diff/tree-mutator-noop-binding.hpp +++ b/src/lib/diff/tree-mutator-noop-binding.hpp @@ -91,7 +91,7 @@ namespace diff{ bool mutateChild (Elm, Buff buff) override ///< ignore inferiors, yet reproduce yourself { - buff.create (BlackHoleMutation()); + buff.emplace (BlackHoleMutation()); return true; } }; diff --git a/src/lib/opaque-holder.hpp b/src/lib/opaque-holder.hpp index 7870597fb..4e4c315a9 100644 --- a/src/lib/opaque-holder.hpp +++ b/src/lib/opaque-holder.hpp @@ -703,7 +703,7 @@ namespace lib { /** - * handle to allow for safe _»remote implantation«_ + * A handle to allow for safe _»remote implantation«_ * of an unknown subclass into a given opaque InPlaceBuffer, * without having to disclose the concrete buffer type or size. * @remarks this copyable value object is especially geared towards use @@ -733,7 +733,7 @@ namespace lib { template BA& - create (SUB&& implementation) + emplace (SUB&& implementation) { if (sizeof(SUB) > maxSiz_) throw error::Fatal("Unable to implant implementation object of size " diff --git a/src/stage/ctrl/notification-hub.hpp b/src/stage/ctrl/notification-hub.hpp index 0f8195c2f..4136ee63e 100644 --- a/src/stage/ctrl/notification-hub.hpp +++ b/src/stage/ctrl/notification-hub.hpp @@ -94,7 +94,7 @@ namespace ctrl { void buildMutator (lib::diff::TreeMutator::Handle buffer) override { - buffer.create ( + buffer.emplace( TreeMutator::build() ); UNIMPLEMENTED ("define and implement what need to be reflected from asset::ErrorLog"); diff --git a/src/stage/interact/interaction-director.cpp b/src/stage/interact/interaction-director.cpp index aa03ac593..b38b54229 100644 --- a/src/stage/interact/interaction-director.cpp +++ b/src/stage/interact/interaction-director.cpp @@ -137,7 +137,7 @@ namespace interact { void InteractionDirector::buildMutator (TreeMutator::Handle buffer) { - buffer.create ( + buffer.emplace( TreeMutator::build() .attach (collection(timelines_) .isApplicableIf ([&](GenNode const& spec) -> bool diff --git a/src/stage/setting/asset-controller.cpp b/src/stage/setting/asset-controller.cpp index c34e07d65..89b8b33f7 100644 --- a/src/stage/setting/asset-controller.cpp +++ b/src/stage/setting/asset-controller.cpp @@ -63,7 +63,7 @@ namespace setting { void AssetController::buildMutator (TreeMutator::Handle buffer) { - buffer.create ( + buffer.emplace( TreeMutator::build() ); UNIMPLEMENTED ("create a sensible binding between AssetManager in the section and AssetController in the UI"); diff --git a/src/stage/timeline/clip-presenter.hpp b/src/stage/timeline/clip-presenter.hpp index a88b28deb..955e7c3a5 100644 --- a/src/stage/timeline/clip-presenter.hpp +++ b/src/stage/timeline/clip-presenter.hpp @@ -141,7 +141,7 @@ namespace timeline { using PEffect = unique_ptr; using PMarker = unique_ptr; - buffer.create ( + buffer.emplace( TreeMutator::build() .attach (collection(markers_) .isApplicableIf ([&](GenNode const& spec) -> bool diff --git a/src/stage/timeline/marker-widget.cpp b/src/stage/timeline/marker-widget.cpp index 1cc235b64..d9b6b8a14 100644 --- a/src/stage/timeline/marker-widget.cpp +++ b/src/stage/timeline/marker-widget.cpp @@ -81,7 +81,7 @@ namespace timeline { void MarkerWidget::buildMutator (TreeMutator::Handle buffer) { - buffer.create ( + buffer.emplace( TreeMutator::build() .change(ATTR_name, [&](string val) { diff --git a/src/stage/timeline/ruler-track.cpp b/src/stage/timeline/ruler-track.cpp index 285a91965..ad7751b8c 100644 --- a/src/stage/timeline/ruler-track.cpp +++ b/src/stage/timeline/ruler-track.cpp @@ -86,7 +86,7 @@ namespace timeline { { UNIMPLEMENTED ("what can actually be manipulated on a RulerTrack by diff message?"); -// buffer.create ( +// buffer.emplace( // TreeMutator::build() // .change(ATTR_name, [&](string val) // { // »Attribute Setter« : receive a new value for the track name field diff --git a/src/stage/timeline/timeline-controller.cpp b/src/stage/timeline/timeline-controller.cpp index beebaf72f..40dc234f6 100644 --- a/src/stage/timeline/timeline-controller.cpp +++ b/src/stage/timeline/timeline-controller.cpp @@ -155,7 +155,7 @@ namespace timeline { using PMarker = unique_ptr; auto rootForkID = fork_->getID(); - buffer.create ( + buffer.emplace( TreeMutator::build() .attach (collection(markers_) .isApplicableIf ([&](GenNode const& spec) -> bool diff --git a/src/stage/timeline/timeline-gui.cpp b/src/stage/timeline/timeline-gui.cpp index a3cee2c58..026e19b3c 100644 --- a/src/stage/timeline/timeline-gui.cpp +++ b/src/stage/timeline/timeline-gui.cpp @@ -113,7 +113,7 @@ namespace timeline { if (this->isActive()) operator*().buildMutator (buffer); // delegate to TimelineController else // else when no widget exists... - buffer.create( + buffer.emplace( TreeMutator::build() .ignoreAllChanges()); // ...consume and ignore diff } diff --git a/src/stage/timeline/track-presenter.hpp b/src/stage/timeline/track-presenter.hpp index 730cbbe17..1d7a66592 100644 --- a/src/stage/timeline/track-presenter.hpp +++ b/src/stage/timeline/track-presenter.hpp @@ -270,7 +270,7 @@ namespace timeline { inline void TrackPresenter::buildMutator (TreeMutator::Handle buffer) { - buffer.create ( + buffer.emplace( TreeMutator::build() .attach (collection(display_.bindRulers()) .isApplicableIf ([&](GenNode const& spec) -> bool diff --git a/tests/library/diff/diff-complex-application-test.cpp b/tests/library/diff/diff-complex-application-test.cpp index 1da758b19..e9fac5140 100644 --- a/tests/library/diff/diff-complex-application-test.cpp +++ b/tests/library/diff/diff-complex-application-test.cpp @@ -201,7 +201,7 @@ namespace test{ void buildMutator (TreeMutator::Handle buff) { - buff.create ( + buff.emplace ( TreeMutator::build() .attach (collection(nestedData_) .isApplicableIf ([&](GenNode const& spec) -> bool diff --git a/tests/library/diff/diff-ignore-changes-test.cpp b/tests/library/diff/diff-ignore-changes-test.cpp index 95c4f3a16..cbc7ec694 100644 --- a/tests/library/diff/diff-ignore-changes-test.cpp +++ b/tests/library/diff/diff-ignore-changes-test.cpp @@ -174,10 +174,10 @@ namespace test{ buildMutator (TreeMutator::Handle buff) { if (diligent) - buff.create( + buff.emplace( TreeMutator()); else - buff.create( + buff.emplace( TreeMutator::build() .ignoreAllChanges()); } @@ -216,7 +216,7 @@ namespace test{ void buildMutator (TreeMutator::Handle buff) { - buff.create( + buff.emplace ( TreeMutator::build() .ignoreAllChanges() .change("γ", [&](double val) { loot = val; })); diff --git a/tests/library/diff/diff-tree-application-simple-test.cpp b/tests/library/diff/diff-tree-application-simple-test.cpp index 4c11f3e84..1f2ca9942 100644 --- a/tests/library/diff/diff-tree-application-simple-test.cpp +++ b/tests/library/diff/diff-tree-application-simple-test.cpp @@ -158,7 +158,7 @@ namespace test{ void buildMutator (TreeMutator::Handle buff) override { - buff.create ( + buff.emplace( TreeMutator::build() .attach (collection (*this) )); diff --git a/tests/library/diff/diff-tree-mutation-listener-test.cpp b/tests/library/diff/diff-tree-mutation-listener-test.cpp index 72815160b..9720fa84b 100644 --- a/tests/library/diff/diff-tree-mutation-listener-test.cpp +++ b/tests/library/diff/diff-tree-mutation-listener-test.cpp @@ -129,7 +129,7 @@ namespace test{ void buildMutator (TreeMutator::Handle buff) override { - buff.create ( + buff.emplace ( TreeMutator::build() .attach (collection (subject_) .matchElement ([](GenNode const& spec, string const& elm) -> bool diff --git a/tests/library/diff/tree-mutator-binding-test.cpp b/tests/library/diff/tree-mutator-binding-test.cpp index 044715634..aaa2344e4 100644 --- a/tests/library/diff/tree-mutator-binding-test.cpp +++ b/tests/library/diff/tree-mutator-binding-test.cpp @@ -551,7 +551,7 @@ namespace test{ { // use our "inside knowledge" to get at the nested scope implementation VecD& subScope = subScopes[subID]; - buff.create ( + buff.emplace ( TreeMutator::build() .attach (collection(subScope) .constructFrom ([&](GenNode const& spec) -> Data @@ -862,7 +862,7 @@ namespace test{ { // NOTE: we use "implementation inside knowledge" regarding the nested scope, // which is here represented as TestMutationTarget - buff.create ( + buff.emplace ( TreeMutator::build() .attachDummy (delta)); diff --git a/tests/stage/test/mock-elm.hpp b/tests/stage/test/mock-elm.hpp index 3e287323b..8784e650b 100644 --- a/tests/stage/test/mock-elm.hpp +++ b/tests/stage/test/mock-elm.hpp @@ -232,7 +232,7 @@ namespace test{ log_.call (this->identify(), "buildMutator"); cout << this->identify() << " <-- DIFF" < bool diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index dd141e861..8149d6b93 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -32882,11 +32882,19 @@ - - + + + + - - + + + + + + + + @@ -32926,8 +32934,13 @@ - - + + + + + + + @@ -33203,8 +33216,8 @@ - - + + @@ -33332,6 +33345,142 @@ + + + + + + + + +

+ typischerweise liefern die low-level-Events gerätespezifische Koordinaten ab, und deren Übersetzung in die Modell/Domänenwerte erfordert Hilfsmittel, die man sich mehrstufig beschaffen muß. Da aber die einzelnen Events unverbunden daherkommen, muß die Verarbeitung vereinzelt erfolgen. Und das heißt, man leistet diesen Einrichtungs-Aufwand für jedes einzelne Event; dies geht zu Lasten der »Reaktivität« +

+ +
+
+ + + + + + +

+ ...wenn man nun eine fest-vorbereitete Lösung für jeden Fall vorsieht, wird die Schnittstelle bereit, unübersichtlich und könnte im Lauf der Zeit verwuchern. Zudem muß eine komplexe Konvention errichtet werden, wer wann für wen welche Variante aufruft +

+ +
+
+ + + + + + +

+ Daher erscheint ein Adapter sinnvoll, der jeweils für eine einzelne Gesten-Instanz erzeugt wird. Dies erfordert jedoch Storage, welche ohne großen Overhead bereitgestellt und effizient genutzt sein will +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +

+ ...sobald irgendwo eine Abstraktionsbarriere errichtet wird, muß mindestens ein Call indirekt oder virtuell sein.... +

+
    +
  • + die Abstraktion zwischen Widget und Canvas muß ich erhalten, weil die Timeline-Anzeige noch ziemlich komplex wird +
  • +
  • + sofern der Gesten-Controller mit beliebigen Widgets umgehen soll, gibt es eine weitere Abstraktion +
  • +
+ +
+ +
+ + + + + + + +
    +
  • + im Bezug auf die Performance weiß ich nicht, wo die Meßlatte liegt +
  • +
  • + die tatsächlich benötigte Abstraktion kann sich noch als ganz anders herausstellen +
  • +
+ +
+ +
+
+
+ + + + + + + + +

+ ...die konkrete Interpretation der Mausbewegung +

+ +
+
+ + + + + + + +

+ ...sonst würde entweder das Subject selber ad hoc etwas bereitstellen müssen und dafür zusätzliche Storage brauchen (Hebel, es gibt sehr viele Subjekte!), oder das Interface "Subject" würde löchrigt und zu einer Kodifizierung von Einzelfällen. Die Lösung mit dem Adapter stattdessen fällt unter das Prinzip Inversion of Control +

+ +
+
+ + + + + + + + +
+
@@ -33437,6 +33586,7 @@ +