From 93bb64d6a2b91dbdcf53f71410e14ba7cadb4cb9 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 1 Jan 2025 03:23:23 +0100 Subject: [PATCH] Invocation: storage layout for Param-Weaving-Pattern ...intended to be used as a Turnout for a ''Param Agent Node....'' This leads to several problems, since the ''chain-data-block'' was defined to be non-copyable, which as such is a good idea, since it will be accessed by a force-cast through the TurnoutSystem. So the question is how to group and arrange the various steps into the general scheme of a Weaving-Pattern... --- src/lib/hetero-data.hpp | 6 + src/lib/uninitialised-storage.hpp | 2 +- src/steam/engine/param-weaving-pattern.hpp | 89 +++++------- tests/core/steam/engine/node-feed-test.cpp | 8 ++ wiki/thinkPad.ichthyo.mm | 156 +++++++++++++++++++++ 5 files changed, 204 insertions(+), 57 deletions(-) diff --git a/src/lib/hetero-data.hpp b/src/lib/hetero-data.hpp index 8aacc375a..7a390454f 100644 --- a/src/lib/hetero-data.hpp +++ b/src/lib/hetero-data.hpp @@ -255,6 +255,12 @@ namespace lib { { return {initArgs ...}; // Note: NewFrame is non-copyable } + template + static NewFrame& + emplace (void* storage, INIT&& ...initArgs) ///< placement-new flavour of the builder notation + { + return * new(storage) NewFrame{initArgs ...}; + } template static auto& diff --git a/src/lib/uninitialised-storage.hpp b/src/lib/uninitialised-storage.hpp index 8402c6782..29ecf9b88 100644 --- a/src/lib/uninitialised-storage.hpp +++ b/src/lib/uninitialised-storage.hpp @@ -75,7 +75,7 @@ namespace lib { * @tparam T the nominal type assumed to sit in each »slot« * @tparam cnt number of »slots« in the array */ - template + template class UninitialisedStorage { using _Arr = std::array; diff --git a/src/steam/engine/param-weaving-pattern.hpp b/src/steam/engine/param-weaving-pattern.hpp index 5341d37e8..85711cbda 100644 --- a/src/steam/engine/param-weaving-pattern.hpp +++ b/src/steam/engine/param-weaving-pattern.hpp @@ -43,19 +43,13 @@ #include "steam/engine/turnout.hpp" #include "steam/engine/turnout-system.hpp" #include "steam/engine/feed-manifold.hpp" ////////////TODO wegdamit -#include "lib/meta/function.hpp" +#include "lib/uninitialised-storage.hpp" #include "lib/meta/variadic-helper.hpp" #include "lib/meta/tuple-helper.hpp" -/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation -//#include "vault/gear/job.h" -//#include "steam/engine/exit-node.hpp" -//#include "lib/time/timevalue.hpp" -//#include "lib/linked-elements.hpp" +#include "lib/meta/function.hpp" #include "lib/several.hpp" -//#include "lib/util-foreach.hpp" -//#include "lib/iter-adapter.hpp" -//#include "lib/meta/function.hpp" -//#include "lib/itertools.hpp" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation +//#include "lib/time/timevalue.hpp" //#include "lib/util.hpp" ////////OOO wegen manifoldSiz() //#include @@ -110,6 +104,7 @@ namespace engine { */ using ChainCons = typename lib::meta::RebindVariadic::Type; + /** invoke all parameter-functors and _drop off_ the result into a »chain-block« (non-copyable) */ typename ChainCons::NewFrame buildParamDataBlock (TurnoutSystem& turnoutSys) { @@ -120,6 +115,17 @@ namespace engine { ,functors_); } + /** invoke all parameter-functors and package all results by placement-new into a »chain-block« */ + void + emplaceParamDataBlock (void* storage, TurnoutSystem& turnoutSys) + { + std::apply ([&](auto&&... paramFun) + { // invoke parameter-functors and build NewFrame from results + ChainCons::emplace (storage, paramFun (turnoutSys) ...); + } + ,functors_); + } + template class Slot @@ -167,86 +173,57 @@ namespace engine { /** * Implementation for a _Weaving Pattern_ to conduct extended parameter evaluation. */ - template + template struct ParamWeavingPattern - : INVO + : util::MoveOnly { - using Feed = typename INVO::Feed; + using Functors = typename SPEC::Functors; + using DataBlock = typename SPEC::ChainCons::NewFrame; - static_assert (_verify_usable_as_InvocationAdapter()); + Functors paramFunctors; - Several leadPort; - Several outTypes; + struct Feed + : util::NonCopyable + { + lib::UninitialisedStorage buffer; + }; - uint resultSlot{0}; /** forwarding-ctor to provide the detailed input/output connections */ template - ParamWeavingPattern (Several&& pr - ,Several&& dr - ,uint resultIdx - ,ARGS&& ...args) - : INVO{forward(args)...} - , leadPort{move(pr)} - , outTypes{move(dr)} - , resultSlot{resultIdx} + ParamWeavingPattern (Functors funTup) + : paramFunctors{move (funTup)} { } Feed mount (TurnoutSystem& turnoutSys) { - ENSURE (leadPort.size() <= INVO::FAN_I); - ENSURE (outTypes.size() <= INVO::FAN_O); - return INVO::buildFeed (turnoutSys); + return Feed{}; } void pull (Feed& feed, TurnoutSystem& turnoutSys) { - if constexpr (Feed::hasInput()) - for (uint i=0; i; + using Feed = WaPa::Feed; + + Feed feed; + spec.emplaceParamDataBlock (& feed.buffer[0], turnoutSys); +SHOW_EXPR(feed.buffer[0].get<0>()) +SHOW_EXPR(feed.buffer[0].get<1>()) TODO ("implement a simple Builder for ParamAgent-Node"); TODO ("then use both together to demonstrate a param data feed here"); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 9f5bfc44e..21e17251c 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -94370,6 +94370,162 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + +

+ denn ich kann nicht ein non-copyable-Member fertig per Konstruktor bekommen.... +

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

+ heißt, man müßte entweder explizit umkopieren, oder es bräuchte eine Konvention, wie man das (optional) gegebene BuffHandle dann eben doch frei gibt; letztlich wird ja ein BuffHandle zurückgegeben, und das wäre dann dasjenige, daß vom rekursiven Call belegt wurde. Könnte sogar klappen, ist aber als Trickserei zu werten. +

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

+ Die Aufteilung in diese fünf Schritte dient vor allem der Gliederung der Abläufe; es ist aber nur bedingt ein »Protokoll«, in dem in bestimmten Schritten etwas Festgelegtes passieren muß... +

+ + +
+
+ + + + + + +

+ Wenn man Strukturen biegen, leer machen oder umdeuten muß... +

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

+ ...da gibt es definitiv keinen anderen Ausweg, und eigentlich wird ja dadurch auch erst die Builder-Notation wirklich sinnvoll; daß man ein non-copyable-Objekt aus einer Funktion „abwerfen“ kann ist sowiso grenzwertig.... +

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

+ ...damit man sieht, wie man's tatsächlich braucht; +

+

+ oder anders herum, das sind die hexagonalen Gefahren der testgetriebenen Entwicklung — ich bastel jetzt schon seit 3 Wochen in diversen Inkrementen an einer Lösung herum, die in ihrer vollen Allgemeingültigkeit rein auf Verdacht geschaffen wurde. Und jetzt bin ich in einem Exkurs angekommen, der mal rein vorsorglich einen extremen Grenzfall schon durchspielt, und erst hier kommt der ganze tolle Entwurf zum ersten Mal zum Einsatz..... +

+

+ +

+

+ trotzdem ziemlich durchgeknallt was ich hier mache +

+

+ (und ich mache es dennoch, weil ich weiß, daß für einen Film-Editor des geplanten Kallibers alle diese abgefuckten Sonderfälle dann später auch tatsächlich gefordert und eingesetzt werden)  +

+ + +
+ + +
+
+
+