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...
This commit is contained in:
parent
fe75bed227
commit
93bb64d6a2
5 changed files with 204 additions and 57 deletions
|
|
@ -255,6 +255,12 @@ namespace lib {
|
|||
{
|
||||
return {initArgs ...}; // Note: NewFrame is non-copyable
|
||||
}
|
||||
template<typename...INIT>
|
||||
static NewFrame&
|
||||
emplace (void* storage, INIT&& ...initArgs) ///< placement-new flavour of the builder notation
|
||||
{
|
||||
return * new(storage) NewFrame{initArgs ...};
|
||||
}
|
||||
|
||||
template<class HET>
|
||||
static auto&
|
||||
|
|
|
|||
|
|
@ -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<typename T, size_t cnt>
|
||||
template<typename T, size_t cnt =1>
|
||||
class UninitialisedStorage
|
||||
{
|
||||
using _Arr = std::array<T,cnt>;
|
||||
|
|
|
|||
|
|
@ -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<FUN>()
|
||||
|
||||
//#include <stack>
|
||||
|
|
@ -110,6 +104,7 @@ namespace engine {
|
|||
*/
|
||||
using ChainCons = typename lib::meta::RebindVariadic<ANK::template Chain, ParamTup>::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<size_t slot>
|
||||
class Slot
|
||||
|
|
@ -167,86 +173,57 @@ namespace engine {
|
|||
/**
|
||||
* Implementation for a _Weaving Pattern_ to conduct extended parameter evaluation.
|
||||
*/
|
||||
template<class INVO>
|
||||
template<class SPEC>
|
||||
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<Feed>());
|
||||
Functors paramFunctors;
|
||||
|
||||
Several<PortRef> leadPort;
|
||||
Several<BuffDescr> outTypes;
|
||||
struct Feed
|
||||
: util::NonCopyable
|
||||
{
|
||||
lib::UninitialisedStorage<DataBlock> buffer;
|
||||
};
|
||||
|
||||
uint resultSlot{0};
|
||||
|
||||
/** forwarding-ctor to provide the detailed input/output connections */
|
||||
template<typename...ARGS>
|
||||
ParamWeavingPattern (Several<PortRef>&& pr
|
||||
,Several<BuffDescr>&& dr
|
||||
,uint resultIdx
|
||||
,ARGS&& ...args)
|
||||
: INVO{forward<ARGS>(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<leadPort.size(); ++i)
|
||||
{
|
||||
BuffHandle inputData = leadPort[i].get().weave (turnoutSys);
|
||||
feed.inBuff.createAt(i, move(inputData));
|
||||
}
|
||||
UNIMPLEMENTED ("pull parameter functors");
|
||||
}
|
||||
|
||||
void
|
||||
shed (Feed& feed, OptionalBuff outBuff)
|
||||
{
|
||||
for (uint i=0; i<outTypes.size(); ++i)
|
||||
{
|
||||
BuffHandle resultData =
|
||||
i == resultSlot and outBuff? *outBuff
|
||||
: outTypes[i].lockBuffer();
|
||||
feed.outBuff.createAt(i, move(resultData));
|
||||
}
|
||||
feed.connect();
|
||||
UNIMPLEMENTED ("connect and postprocess");
|
||||
}
|
||||
|
||||
void
|
||||
weft (Feed& feed)
|
||||
{
|
||||
feed.invoke(); // process data
|
||||
UNIMPLEMENTED ("forward to delegate");
|
||||
}
|
||||
|
||||
BuffHandle
|
||||
fix (Feed& feed)
|
||||
{
|
||||
if constexpr (Feed::hasInput())
|
||||
for (uint i=0; i<leadPort.size(); ++i)
|
||||
{
|
||||
feed.inBuff[i].release();
|
||||
}
|
||||
for (uint i=0; i<outTypes.size(); ++i)
|
||||
{
|
||||
feed.outBuff[i].emit(); // state transition: data ready
|
||||
if (i != resultSlot)
|
||||
feed.outBuff[i].release();
|
||||
}
|
||||
ENSURE (resultSlot < INVO::FAN_O, "invalid result buffer configured.");
|
||||
return feed.outBuff[resultSlot];
|
||||
UNIMPLEMENTED ("clean-up and return result buff");
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -175,6 +175,14 @@ namespace test {
|
|||
turnoutSys.detachChainBlock(paramBlock);
|
||||
}
|
||||
|
||||
using Spec = decltype(spec);
|
||||
using WaPa = ParamWeavingPattern<Spec>;
|
||||
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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94370,6 +94370,162 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<arrowlink COLOR="#5747d2" DESTINATION="ID_329885446" ENDARROW="Default" ENDINCLINATION="-844;-25;" ID="Arrow_ID_1824926310" STARTARROW="None" STARTINCLINATION="-633;42;"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1735607847586" ID="ID_326138637" MODIFIED="1735698010312" TEXT="Weaving-Pattern passend anlegen">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1735606520452" ID="ID_1370206629" MODIFIED="1735607879217" TEXT="Knackpunkt hier: Chain-Block ist non-copyable">
|
||||
<node CREATED="1735606533963" ID="ID_232275034" MODIFIED="1735606547772" TEXT="das geht sehr wohl: FeedManifold ist ebenfalls non-copyable"/>
|
||||
<node CREATED="1735607046676" ID="ID_1197786320" MODIFIED="1735607106657" TEXT="Konsequenz wäre, anschließend noch explizit ans Turnout-System »andocken« zu müssen"/>
|
||||
<node CREATED="1735607701692" ID="ID_1665864698" MODIFIED="1735607715223" TEXT="oder — — RAII">
|
||||
<node CREATED="1735607772387" ID="ID_1329533749" MODIFIED="1735607838831" TEXT="geht das überhaupt?"/>
|
||||
<node CREATED="1735607884541" ID="ID_809521085" MODIFIED="1735607928616" TEXT="nur wenn man erbt">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
denn ich kann nicht ein non-copyable-Member fertig per Konstruktor bekommen....
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1735607937133" ID="ID_328206928" MODIFIED="1735607951086" TEXT="oder wenn man den Funktor bekommt und selber aufruft"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#f0d5c5" COLOR="#990033" CREATED="1735608975638" ID="ID_1109142296" MODIFIED="1735609812282" TEXT="zweite Frage: wann?">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1735608988000" ID="ID_895559050" MODIFIED="1735693559907" TEXT="echtes RAII ⟹ dann sofort">
|
||||
<node CREATED="1735609004510" ID="ID_1911256331" MODIFIED="1735609026839" TEXT="würde bedeuten: praktisch alles passiert im mount(TurnoutSystem&)"/>
|
||||
<node CREATED="1735609090986" ID="ID_951840714" MODIFIED="1735609113027" TEXT="für die (optionale) Nachverarbeitung bleibt noch Design-Spielraum"/>
|
||||
<node CREATED="1735609138368" ID="ID_1518007270" MODIFIED="1735609168204" TEXT="man würde dann aber wohl auch schon in pull() an die Delegate-Node weitergeben"/>
|
||||
<node CREATED="1735609243446" ID="ID_812134786" MODIFIED="1735609281948" TEXT="eine Inkonsistenz ergibt sich in shed()....">
|
||||
<node CREATED="1735609283480" ID="ID_1850616450" MODIFIED="1735609297842" TEXT="denn den (optionalen) Ausgabe-Buffer gäbe es erst hier"/>
|
||||
<node CREATED="1735609299238" ID="ID_665339625" MODIFIED="1735609315400" TEXT="der rekursive Call hatte keinen zur Verfügung"/>
|
||||
<node CREATED="1735609349100" ID="ID_396734688" MODIFIED="1735609491766" TEXT="als müßte man hier dann das BuffHandle „umleiten“">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
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<i> als Trickserei</i> zu werten.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1735609494932" ID="ID_1864279920" MODIFIED="1735609503487" TEXT="der weft()-Aufruf wäre komplett NOP">
|
||||
<node CREATED="1735609505407" ID="ID_1526678544" MODIFIED="1735609651872" TEXT="warum auch nicht....">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
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 <i>passieren muß...</i>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
<node CREATED="1735609517769" ID="ID_302975776" MODIFIED="1735609561229" TEXT="trotzdem ein Hinweis, daß mit dem Design etwas nicht stimmt">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
Wenn man Strukturen biegen, leer machen oder umdeuten muß...
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1735609958198" ID="ID_962342769" MODIFIED="1735609995692" TEXT="oder man macht alles in irgend einem anderen passenden Aufruf">
|
||||
<icon BUILTIN="smiley-angry"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1735609684093" ID="ID_1602209150" MODIFIED="1735609699782" TEXT="oder: einen UninitialisedStorage-Block vorsehen">
|
||||
<node CREATED="1735609703440" ID="ID_1428111001" MODIFIED="1735609715570" TEXT="die Größe ist ja im Voraus bekannt"/>
|
||||
<node CREATED="1735609732772" ID="ID_1616902380" MODIFIED="1735609783730" TEXT="Schön ist das nicht....">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
<icon BUILTIN="smily_bad"/>
|
||||
</node>
|
||||
<node CREATED="1735609785413" ID="ID_186365228" MODIFIED="1735609807785" TEXT="dafür aber würden die anderen Aufrufe in etwa das machen was man erwartet">
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#ccb59b" COLOR="#6e2a38" CREATED="1735693114640" ID="ID_167218109" MODIFIED="1735693140760" TEXT="dann aber auch besser alles explizit machen">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="14"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1735693540805" ID="ID_647246098" MODIFIED="1735693549403" TEXT="Typ-Parametrisierung">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1735693996066" ID="ID_40351970" MODIFIED="1735694009501" TEXT="auch hier eine Art Prototype...."/>
|
||||
<node CREATED="1735694010801" ID="ID_914830627" MODIFIED="1735694086013" TEXT="das heißt: das Weaving-Pattern muß das Funktoren-Tupel enthalten"/>
|
||||
<node CREATED="1735694092810" ID="ID_1337845365" MODIFIED="1735694220094" TEXT="⟹ die ParamBuildSpec ist der natürliche Typ-Parameter">
|
||||
<node CREATED="1735694224570" ID="ID_93398992" MODIFIED="1735694245041" TEXT="enthält eine nested Type-def für das Funktoren-Tupel"/>
|
||||
<node CREATED="1735694246354" ID="ID_1680447149" MODIFIED="1735694265234" TEXT="enthält aber auch die Zustatz-Info über die Chain-Struktur (ANK)"/>
|
||||
</node>
|
||||
<node CREATED="1735694325648" ID="ID_836420159" MODIFIED="1735694338272" TEXT="(wäre dann move-only wie alle Funktoren hier)"/>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1735697993386" ID="ID_797613352" MODIFIED="1735698002027" TEXT="+ weitere Parametrisierung">
|
||||
<icon BUILTIN="flag-pink"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1735696073802" ID="ID_1789382943" MODIFIED="1735696136906" TEXT="ParamBlock erstellen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#f8f1cb" COLOR="#a50125" CREATED="1735696138642" ID="ID_410550585" MODIFIED="1735696170853" TEXT="erneut das Problem: der Chain-Block soll non-copyable sein">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1735696214236" ID="ID_1168622804" MODIFIED="1735697968996" TEXT="brauche folglich eine placement-new-Variante des Builders">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...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....
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<node BACKGROUND_COLOR="#c8cbaf" CREATED="1735697219515" ID="ID_1960332816" MODIFIED="1735697251917" TEXT="warum ärgere ich mich jetz darüber so?">
|
||||
<icon BUILTIN="smiley-angry"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#ccb59b" COLOR="#6e2a38" CREATED="1735697259608" ID="ID_1882455580" MODIFIED="1735697659702" TEXT="deshalb macht man doch Prototyping....">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...damit man sieht, wie man's tatsächlich braucht;
|
||||
</p>
|
||||
<p>
|
||||
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<i> mal rein vorsorglich</i> einen extremen Grenzfall schon durchspielt, und erst hier kommt der ganze tolle Entwurf zum ersten Mal zum Einsatz.....
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<i><font color="#82159f">trotzdem ziemlich durchgeknallt was ich hier mache </font></i>
|
||||
</p>
|
||||
<p>
|
||||
<font color="#491fdd" size="2">(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)</font> 
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="14"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1735354094901" ID="ID_357401280" LINK="#ID_1484484879" MODIFIED="1735416065935" TEXT="Grundstruktur / Schrittfolge">
|
||||
<node CREATED="1735354099466" ID="ID_1086019960" MODIFIED="1735354156573" TEXT="mount : Feed-Frame erzeugen"/>
|
||||
<node CREATED="1735354158273" ID="ID_1400465949" MODIFIED="1735354198247" TEXT="pull : Param-Funktor aufrufen und Tupel erstellen"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue