Invocation: draft accessor and constructor scheme

- the Accessor is pretty much obvious: it carries the type from the enclosing scope and delegates to the generic accessor there
- the Constructor however is much more challenging, because it must construct the chained type ahead, and prepare a constructor functor that can be applied ''later'' to the actual data chain
This commit is contained in:
Fischlurch 2024-12-10 01:38:00 +01:00
parent bc6b69ce71
commit 54dc8cc032
2 changed files with 120 additions and 48 deletions

View file

@ -56,6 +56,7 @@
namespace lib {
struct StorageLoc
: util::NonCopyable
{
StorageLoc* next{nullptr};
};
@ -64,9 +65,8 @@ namespace lib {
struct StorageFrame
: StorageLoc
, std::tuple<DATA...>
, util::NonCopyable
{
using std::tuple<DATA...>::tuple;
};
/**
@ -74,7 +74,7 @@ namespace lib {
template<class SPEC>
class HeteroData
{
/////////////////////////OOO do we need this as marker for an unspecified front-end?
};
template<class TAIL, typename...DATA>
@ -119,10 +119,22 @@ namespace lib {
return accessTail().template get<slot-localSiz>();
}
struct Navigator
template<size_t slot>
struct Accessor
{
using Type = Elm_t<slot>;
template<class SPEC>
Type&
get (HeteroData<SPEC>& frontEnd)
{
auto& fullChain = reinterpret_cast<_Self&> (frontEnd);
return fullChain.template get<slot>();
}
};
template<typename...VALS>
using Constructor = typename _Tail::template Constructor<VALS...>;
};
template<>
@ -130,6 +142,19 @@ namespace lib {
{
public:
static size_t constexpr size() { return 0; }
template<typename...DATA>
struct Constructor
{
using Chain = HeteroData<meta::Node<StorageFrame<DATA...>, meta::NullType>>;
template<typename...INIT>
typename Chain::Frame
operator() (INIT&& ...initArgs)
{
return {initArgs ...};
}
};
};

View file

@ -21280,9 +21280,7 @@
<icon BUILTIN="button_ok"/>
<node CREATED="1575240328218" ID="ID_154585759" MODIFIED="1575240345695">
<richcontent TYPE="NODE"><html>
<head>
</head>
<head/>
<body>
<p>
ViewHooked wird nun zum <b>eigentlichen Front-End</b>
@ -21876,9 +21874,7 @@
<icon BUILTIN="button_cancel"/>
<node CREATED="1573242119197" ID="ID_1160468015" MODIFIED="1576282358091" TEXT="geht nicht ohne Weiteres">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
&quot;the children of your friends ain't necessarily your friends&quot;
@ -22419,9 +22415,7 @@
</node>
<node CREATED="1480121092492" ID="ID_1543810707" MODIFIED="1576282358085" TEXT="L&#xf6;schungen nur heuristisch zu erkennen">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
Weil wir die &quot;skip&quot;-Operation f&#252;r zwei Zwecke verwenden,
@ -23043,9 +23037,7 @@
<node CREATED="1480780494717" ID="ID_432076484" MODIFIED="1518487921082" TEXT="Bewertung">
<node CREATED="1480780498437" ID="ID_1806301944" MODIFIED="1539382659226" TEXT="nur die Ctor-L&#xf6;sung ist geradlinig">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
das hei&#223;t, nur diese L&#246;sung gr&#252;ndet in der Natur der behandelten Sachverhalte.
@ -24161,9 +24153,7 @@
<node CREATED="1582990257583" ID="ID_551100173" MODIFIED="1582990261149" TEXT="von links nach rechts">
<node CREATED="1582990493888" ID="ID_1406728700" MODIFIED="1582990515278" TEXT="fast immer ausgeschlossen">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
da links-&gt;rechts auf die Zeitachse abgebildet ist
@ -25927,9 +25917,7 @@
</node>
<node CREATED="1563468083453" ID="ID_988508640" MODIFIED="1576282358068" TEXT="Interface Gtk::Container ist nur f&#xfc;r single-Child">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
&quot;This interface is used for all single item holding containers. Multi-item containers provide their own unique interface as their items are generally more complex. The methods of the derived classes should be prefered over these...&quot;
@ -29352,9 +29340,7 @@
<icon BUILTIN="help"/>
<node CREATED="1555808201687" ID="ID_191950649" MODIFIED="1557498707229" TEXT="&quot;Zwiebelschalen-Konstrukt&quot;??">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
zwei verschachtelte, delegierende Konstruktoren,
@ -33268,9 +33254,7 @@
</node>
<node COLOR="#338800" CREATED="1566958520767" ID="ID_350091895" MODIFIED="1576282358042" TEXT="diagnostisches Hilfs-drawing sollte Canvas-Gr&#xf6;&#xdf;e als Bezug verwenden">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
....f&#252;r den Kreis
@ -37267,9 +37251,7 @@
<icon BUILTIN="yes"/>
<node BACKGROUND_COLOR="#cec3da" CREATED="1613917449274" HGAP="42" ID="ID_1824168791" MODIFIED="1613917680542" VSHIFT="4">
<richcontent TYPE="NODE"><html>
<head>
</head>
<head/>
<body>
<p>
<u>Achtung</u>: <i><font color="#402160">abstrakter Entwurf war Ende 2017 in eine Sackgasse geraten....</font></i>
@ -39185,9 +39167,7 @@
<node CREATED="1620913445509" ID="ID_1831141576" MODIFIED="1620913451984" TEXT="bringt aber nix"/>
<node CREATED="1620913452692" ID="ID_339655971" MODIFIED="1620913529933" TEXT="und au&#xdf;erdem benutze ich den Pointer auch als Flag">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
...und das ist eleganter, als jede der denkbaren Alternativen
@ -39947,9 +39927,7 @@
<node CREATED="1672672872277" ID="ID_1511854867" MODIFIED="1672672879900" TEXT="geplant..."/>
<node CREATED="1672672880622" ID="ID_1994765001" MODIFIED="1672672913962" TEXT="wohl erst viel sp&#xe4;ter zu implementieren">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
Gesamt-Integration der Applikation ist derzeit (2023) viel wichtiger
@ -40472,9 +40450,7 @@
</node>
<node CREATED="1667349853811" ID="ID_1951953580" MODIFIED="1667350032602" TEXT="Canvas vergr&#xf6;&#xdf;ern? oder visible Window verkleinern?">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<ul>
<li>
@ -40787,9 +40763,7 @@
<node CREATED="1667659622859" ID="ID_828891167" MODIFIED="1667659633949" TEXT="&#xbb;conformMetricToWindow&#xab;"/>
<node COLOR="#435e98" CREATED="1671236817013" ID="ID_661439299" LINK="#ID_1175951405" MODIFIED="1671236839666">
<richcontent TYPE="NODE"><html>
<head>
</head>
<head/>
<body>
<p>
das ist das <b>Kernst&#252;ck</b>
@ -40967,9 +40941,7 @@
<icon BUILTIN="button_ok"/>
<node CREATED="1667747398556" ID="ID_952719507" MODIFIED="1667747493566" TEXT="wie schon vermutet">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<head/>
<body>
<p>
es kommt eine negative Zahl heraus: IntMax * Scale &#10236; -Scale&#160;&#160;(im Nenner)
@ -87865,13 +87837,88 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
der Umweg &#252;ber lib::LinkedElements ist &#252;berfl&#252;ssig, zumal ich durch direkte rekursive Implementierung auch noch eine klare Fehlermeldung erzeugen kann, falls ein Nachfolge-Extent noch nicht alloziert wurde
</p>
</body>
</html>
</richcontent>
</html></richcontent>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1733799750738" ID="ID_532258033" MODIFIED="1733799768652" TEXT="Implementierung ausarbeiten">
<icon BUILTIN="pencil"/>
<node CREATED="1733804423613" ID="ID_1306152229" MODIFIED="1733804462327" TEXT="Zugriff">
<node COLOR="#338800" CREATED="1733804463800" ID="ID_1686530886" MODIFIED="1733804491599" TEXT="definiere den Datentyp rekursiv">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1733804471735" ID="ID_217423476" MODIFIED="1733804494202" TEXT="per Spezialisierung &#xfc;ber eine Loki-Typliste">
<icon BUILTIN="idea"/>
</node>
<node CREATED="1733804500755" ID="ID_1984459330" MODIFIED="1733804525607" TEXT="damit alle Zugriffe auf Index-Bedingung zur&#xfc;ckgef&#xfc;hrt"/>
<node COLOR="#338800" CREATED="1733804529591" ID="ID_811390325" MODIFIED="1733804573211" TEXT="Accessor als nested Template &#x27f9; enth&#xe4;lt implizit den Typ der gesamten Chain">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1733804575033" ID="ID_374529337" MODIFIED="1733804581760" TEXT="Konstruktur">
<icon BUILTIN="pencil"/>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1733804582990" ID="ID_234262358" MODIFIED="1733804620663" TEXT="puh ... komplex">
<icon BUILTIN="smily_bad"/>
<node CREATED="1733804622226" ID="ID_13001974" MODIFIED="1733804637342" TEXT="ich will zuerst Konstruktor-Typen konstruieren">
<node CREATED="1733804722045" ID="ID_1072077887" MODIFIED="1733804736615" TEXT="von diesem sollen bereits Accessoren abgenommen werden k&#xf6;nnen"/>
<node CREATED="1733804737539" ID="ID_1952717306" MODIFIED="1733804757279" TEXT="und ich m&#xf6;chte darauf einen Chain-Konstruktor erzeugen k&#xf6;nnen"/>
</node>
<node CREATED="1733804639421" ID="ID_8512020" MODIFIED="1733804766803" TEXT="Konstruktoren sollen sich automatisch an einen bestehenden HeteroData-Typ anh&#xe4;ngen"/>
<node CREATED="1733804662525" ID="ID_1640222718" MODIFIED="1733804704916">
<richcontent TYPE="NODE"><html>
<head/>
<body>
<p>
bei Aufruf wird dann der eigentliche Storage-Frame <i>erzeugt <b>und</b>&#160; registriert</i>
</p>
</body>
</html>
</richcontent>
</node>
<node BACKGROUND_COLOR="#f8f1cb" COLOR="#a50125" CREATED="1733804769854" ID="ID_148296974" MODIFIED="1733804802554" TEXT="Problem: diese Registrierung ist kniffelig">
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1733804807001" ID="ID_1917086593" MODIFIED="1733804863683" TEXT="der StorageFrame is non-copyable">
<richcontent TYPE="NOTE"><html>
<head/>
<body>
<p>
das hei&#223;t, ich kann ihn nur per RVO aus einer Konstruktor-Funktion heraus &#8222;abwerfen&#8220;
</p>
</body>
</html></richcontent>
</node>
<node CREATED="1733804865881" ID="ID_773281512" MODIFIED="1733804902322">
<richcontent TYPE="NODE"><html>
<head/>
<body>
<p>
aber <i>danach erst </i>ist die Speicher-Adresse bekannt
</p>
</body>
</html></richcontent>
</node>
<node CREATED="1733804878464" ID="ID_1996046529" MODIFIED="1733804914049">
<richcontent TYPE="NODE"><html>
<head/>
<body>
<p>
und <i>diese</i>&#160;mu&#223; nun in einen Vorg&#228;nger-Frame geschrieben werden
</p>
</body>
</html>
</richcontent>
</node>
<node BACKGROUND_COLOR="#fafe99" COLOR="#fa002a" CREATED="1733804917746" ID="ID_1185565269" MODIFIED="1733804932336" TEXT="??? Woot ???">
<icon BUILTIN="smily_bad"/>
<node CREATED="1733804944471" ID="ID_1490645699" MODIFIED="1733804971335" TEXT="Idee-1 : Storage-Frame bekommt zus&#xe4;tzlichen pointer-Parameter"/>
<node CREATED="1733804972427" ID="ID_1289574080" MODIFIED="1733804987877" TEXT="Idee-2 : etwas mit Lambdas zaubern....?">
<node CREATED="1733805043593" ID="ID_1213049717" MODIFIED="1733805053163" TEXT="Funktions-Verkettung?"/>
<node CREATED="1733805057589" ID="ID_938270964" MODIFIED="1733805072169" TEXT="irgendwie vom letzten HeteroData aus einschie&#xdf;en???"/>
</node>
</node>
</node>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1733767161520" ID="ID_1853669534" MODIFIED="1733767188150" TEXT="Standard-Definition f&#xfc;r TurnoutSystem auf dieser Basis">
<icon BUILTIN="flag-yellow"/>