From fa720ae975d963dfdd7b6458a34f3513b70c09c7 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 4 Feb 2025 00:22:55 +0100 Subject: [PATCH] Invocation: for now only set flags by builder Handling of extended attributes in conjunction with the hash turns out to be a rather complicated topic, with some tricky fine details. And, most important, at the moment I am lacking the proper perspective to address it and find adequate solutions. Luckily, the cache-key is not required at the moment, ''and so this topic will be postponed'' As a minimum to complete the diagnostics functions, it is sufficient to set the appropriate flags in the `ProcID` directly -- and to add some convenience wrappers. --- src/steam/engine/node-builder.hpp | 5 +- src/steam/engine/proc-node.cpp | 44 +++++ src/steam/engine/proc-node.hpp | 9 + tests/core/steam/engine/node-meta-test.cpp | 44 ++++- wiki/thinkPad.ichthyo.mm | 191 ++++++++++++++------- 5 files changed, 220 insertions(+), 73 deletions(-) diff --git a/src/steam/engine/node-builder.hpp b/src/steam/engine/node-builder.hpp index 150f85ec6..1cbd0bcf0 100644 --- a/src/steam/engine/node-builder.hpp +++ b/src/steam/engine/node-builder.hpp @@ -656,6 +656,9 @@ namespace engine { "to perform within the scope with extended parameters" ,LERR_(BOTTOM_VALUE)}; string portSpec = "Par+"+delegatePort_->procID.genProcSpec(); + ProcAttrib flags; + flags.isProxy = true; + flags.manifold = false; using WeavingPattern = ParamWeavingPattern; using TurnoutWeaving = Turnout; @@ -664,7 +667,7 @@ namespace engine { return NodeBuilder ( static_cast&&> (*this) // slice away PortBulder subclass data , SizMark{} ,// prepare a builder-λ to construct the actual Turnout-object - [procID = ProcID::describe(_Par::symbol_,portSpec) + [procID = ProcID::describe(_Par::symbol_,portSpec,flags) ,builder = move(blockBuilder_) ,postProc = move(postProcessor_) ,delegate = delegatePort_ diff --git a/src/steam/engine/proc-node.cpp b/src/steam/engine/proc-node.cpp index 96021386f..5d34a4020 100644 --- a/src/steam/engine/proc-node.cpp +++ b/src/steam/engine/proc-node.cpp @@ -364,6 +364,13 @@ namespace engine { return ports().front().procID.genNodeSpec (leads()); } + string + ProcNodeDiagnostic::getNodeName() + { + REQUIRE (not isnil(ports())); + return ports().front().procID.genNodeName(); + } + HashVal ProcNodeDiagnostic::getNodeHash() ///< @todo not clear yet if this has to include predecessor info { @@ -445,6 +452,12 @@ namespace engine { return p_.procID.genProcSpec(); } + string + PortDiagnostic::getProcName() + { + return p_.procID.genProcName(); + } + HashVal PortDiagnostic::getProcHash() ///< @return as [calculated by Node-identification](\ref ProcID) { @@ -452,4 +465,35 @@ namespace engine { } + /* === cross-navigation === */ + + ProcNodeDiagnostic + ProcNodeDiagnostic::watchLead (uint leadIdx) + { + if (leadIdx >= leads().size()) + throw err::Invalid{_Fmt{"Lead-# %d >= %d (available lead-nodes)."} + % leadIdx % leads().size()}; + return watch (leads()[leadIdx]); + } + + PortDiagnostic + ProcNodeDiagnostic::watchPort (uint portIdx) + { + if (portIdx >= ports().size()) + throw err::Invalid{_Fmt{"Port-idx %d >= %d (available Ports)."} + % portIdx % ports().size()}; + return watch (ports()[portIdx]); + } + + PortDiagnostic + PortDiagnostic::watchLead (uint leadIdx) + { + auto& leadPorts = srcPorts(); + if (leadIdx >= leadPorts.size()) + throw err::Invalid{_Fmt{"Lead-Port# %d >= %d (available src-ports)."} + % leadIdx % leadPorts.size()}; + return watch (leadPorts[leadIdx]); + } + + }} // namespace steam::engine diff --git a/src/steam/engine/proc-node.hpp b/src/steam/engine/proc-node.hpp index 02f13ad7c..11fcd0e5a 100644 --- a/src/steam/engine/proc-node.hpp +++ b/src/steam/engine/proc-node.hpp @@ -259,6 +259,8 @@ namespace engine { /* ========== Diagnostic and Testing ========== */ + class PortDiagnostic; + class ProcNodeDiagnostic : util::MoveOnly { @@ -281,11 +283,15 @@ namespace engine { ///////////////////////////////////////////////////TODO 10/2024 more to verify here } + string getNodeName(); ///< show the node's descriptive name string getNodeSpec(); ///< generate a descriptive Spec of this ProcNode for diagnostics HashVal getNodeHash(); ///< calculate an unique hash-key to designate this node string getPortSpec (uint portIdx); ///< generate a descriptive diagnostic Spec for the designated Turnout HashVal getPortHash (uint portIdx); ///< calculate an unique, stable and reproducible hash-key to identify the Turnout + + ProcNodeDiagnostic watchLead(uint leadIdx); + PortDiagnostic watchPort(uint portIdx); }; inline ProcNodeDiagnostic @@ -310,8 +316,11 @@ namespace engine { bool isSrc() { return srcPorts().empty(); } + string getProcName(); ///< generate a combined name for the node and the qualification of the port string getProcSpec(); ///< generate a descriptive diagnostic Spec for the Turnout sitting behind this Port HashVal getProcHash(); ///< calculate an unique, stable and reproducible hash-key to identify the associated operation + + PortDiagnostic watchLead(uint leadIdx); }; inline PortDiagnostic diff --git a/tests/core/steam/engine/node-meta-test.cpp b/tests/core/steam/engine/node-meta-test.cpp index beb64268a..287476b18 100644 --- a/tests/core/steam/engine/node-meta-test.cpp +++ b/tests/core/steam/engine/node-meta-test.cpp @@ -20,6 +20,7 @@ #include "steam/engine/proc-node.hpp" #include "steam/engine/node-builder.hpp" #include "lib/format-util.hpp" +#include "lib/test/test-helper.hpp" //#include "steam/engine/test-rand-ontology.hpp" ///////////TODO #include "lib/test/diagnostic-output.hpp"/////////////////TODO //#include "lib/util.hpp" @@ -176,13 +177,42 @@ namespace test { .build()}; ///////////////////////////////////////////////////////TODO WIP - Port& p1 = watch(nM).ports()[0]; -SHOW_EXPR(p1.procID.genProcSpec()) - auto& p1src = watch(p1).srcPorts(); - Port& p1s1 = p1src[0]; - Port& p1s2 = p1src[1]; -SHOW_EXPR(p1s1.procID.genProcSpec()) -SHOW_EXPR(p1s2.procID.genProcSpec()) +SHOW_EXPR(watch(nA).getNodeName()) +SHOW_EXPR(watch(nA).getNodeSpec()) +SHOW_EXPR(watch(nA).isSrc()) +SHOW_EXPR(watch(nA).ports().size()) +SHOW_EXPR(watch(nA).watchPort(0).getProcName()) +SHOW_EXPR(watch(nA).watchPort(0).getProcSpec()) +SHOW_EXPR(watch(nA).watchPort(1).getProcSpec()) + VERIFY_FAIL ("Port-idx 2 >= 2 (available Ports)" + ,watch(nA).watchPort(2)); + +SHOW_EXPR(watch(nB).getNodeSpec()) +SHOW_EXPR(watch(nB).isSrc()) +SHOW_EXPR(watch(nB).ports().size()) +SHOW_EXPR(watch(nB).watchPort(0).getProcSpec()) +SHOW_EXPR(watch(nB).watchPort(1).getProcSpec()) +SHOW_EXPR(watch(nB).watchPort(2).getProcSpec()) + +SHOW_EXPR(watch(nM).getNodeName()) +SHOW_EXPR(watch(nM).getNodeSpec()) +SHOW_EXPR(watch(nM).ports().size()) +SHOW_EXPR(watch(nM).watchPort(0).getProcName()) +SHOW_EXPR(watch(nM).watchPort(1).getProcName()) +SHOW_EXPR(watch(nM).watchPort(2).getProcName()) +SHOW_EXPR(watch(nM).watchPort(2).getProcSpec()) +SHOW_EXPR(watch(nM).watchPort(0).srcPorts().size()) +SHOW_EXPR(watch(nM).watchPort(0).watchLead(0).getProcName()) +SHOW_EXPR(watch(nM).watchPort(0).watchLead(1).getProcName()) +SHOW_EXPR(watch(nM).watchPort(1).srcPorts().size()) +SHOW_EXPR(watch(nM).watchPort(1).watchLead(0).getProcName()) +SHOW_EXPR(watch(nM).watchPort(1).watchLead(1).getProcName()) +SHOW_EXPR(watch(nM).watchPort(2).srcPorts().size()) +SHOW_EXPR(watch(nM).watchPort(2).watchLead(0).getProcName()) +SHOW_EXPR(watch(nM).watchPort(2).watchLead(1).getProcName()) +SHOW_EXPR(watch(nM).watchPort(2).watchLead(1).getProcSpec()) +SHOW_EXPR(watch(nM).watchPort(2).watchLead(1).isSrc()) +SHOW_EXPR(watch(nM).watchPort(2).watchLead(1).srcPorts().size()) ///////////////////////////////////////////////////////TODO WIP UNIMPLEMENTED ("verify connectivity"); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index ff751b733..c13f6e7f9 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -101948,11 +101948,15 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + + + + + @@ -102707,26 +102711,26 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - - - - - - - - - - - + + + - - + + + + + + + + + + - + @@ -102824,7 +102828,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -102836,10 +102840,10 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + - + @@ -102974,9 +102978,21 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - + + + + + + + + + + + + + @@ -105114,8 +105130,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) ...braucht einen aktuellen Port-Hash, berechnet aber auf dieser Basis direkt den Beitrag der aktuell erzeugten Parameter-Werte

- - +
@@ -105924,10 +105939,12 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)
- + + - + + @@ -105974,8 +105991,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -106022,8 +106039,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -106127,9 +106144,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - + @@ -106169,13 +106186,13 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + - - - + + + @@ -106233,7 +106250,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -106241,7 +106258,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -106306,9 +106323,10 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + + + @@ -106317,6 +106335,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)

+
@@ -106325,28 +106344,69 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + - - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + +

+ ich glaube nicht, daß es sinnvoll ist, eine Attribut-Map als Ganzes zu de-duplizieren. Empirisch entscheiden können wir das aber leider erst viel später. Ja aber, was machen wir dann bloß? Wenn-wäre-hätte?? Die Node-Storage muß unbedingt klein gehalten werden. Kann aber derzeit überhaupt nicht entscheiden, ob die Vorraussetzungen für eine persistente Datenstruktur (im Sinne der funktionalen Programmierung) gegeben sind.... +

+

+ Daher ziehe ich es vor, den Kopf in den Sand zu stecken.... +

+ +
+
+
+
+ - +
- + - + + - + - + @@ -106355,27 +106415,27 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)

- - + + - - + + - + - + - + - + @@ -106389,12 +106449,13 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + + + - + @@ -148361,8 +148422,8 @@ std::cout << tmpl.render({"what", "World"}) << s - +