From 5df93f01fc7766e8e51de5e1965c008017e734c4 Mon Sep 17 00:00:00 2001
From: Ichthyostega
Date: Sun, 3 Nov 2024 22:55:06 +0100
Subject: [PATCH] Invocation: pass symbolic spec through the node builder
...taking into account the prospecive usage context
where the builder expressions will be invoked from within
a media-library plug-in, using std::string_view to pass
the symbolic information seems like a good fit, because
the given spec will typically be assembled from some
building blocks, and thus in itself not be literal data.
---
src/lib/text-template.hpp | 18 +--
src/steam/engine/node-builder.hpp | 29 +++--
src/steam/engine/proc-id.hpp | 22 +++-
src/steam/engine/proc-node.cpp | 11 +-
src/steam/engine/weaving-pattern-builder.hpp | 13 +-
tests/core/steam/engine/node-linkage-test.cpp | 2 +-
.../core/steam/engine/test-rand-ontology.cpp | 2 +-
.../core/steam/engine/test-rand-ontology.hpp | 6 +-
wiki/thinkPad.ichthyo.mm | 115 ++++++++++++------
9 files changed, 145 insertions(+), 73 deletions(-)
diff --git a/src/lib/text-template.hpp b/src/lib/text-template.hpp
index a06d1ed06..c4bdc9a8d 100644
--- a/src/lib/text-template.hpp
+++ b/src/lib/text-template.hpp
@@ -100,7 +100,7 @@
**
** ## Data Access
**
- ** ** The [instantiation processing logic](\ref TextTemplate::Action::instantiate) is
+ ** The [instantiation processing logic](\ref TextTemplate::Action::instantiate) is
** defined in terms of a *data binding*, represented as TextTemplate::DataSource.
** This binding, assuming a _generic data access protocol,_ has to be supplied by
** a concrete (partial) specialisation of the template `DataSource`. This
@@ -108,11 +108,11 @@
** actual format the data is available. Notably, bindings are pre-defined
** for string data in a Map, and for Lumiera's »[External Tree Description]«
** format, based on a [generic data node](\ref gen-node.hpp). Generally speaking,
- ** the following _abstracted primitive operations_ are required to access data:
+ ** the following _abstracted primitive operations_ are required for accessing data:
** - the `DataSource` object itself is a copyable value object, representing
** an _abstracted reference to the data._ We can assume that it stores a `const *`
** internally, pointing to some data entity residing elsewhere in memory.
- ** - it must somehow be possible, to generate a nested sub-data context, represented
+ ** - it must somehow be possible to generate a nested sub-data context, represented
** by the same reference data type; this implies that there is some implementation
** mechanism in place to tap into a _nested sub-scope_ within the data.
** - `bool dataSrc.contains(key)` checks if a binding is available for the given \a key.
@@ -121,8 +121,8 @@
** the _content_ bound to this \a key. This string content is assumed to remain stable
** in memory during the instantiation process, which exposes a `std::string_view`
** - `Iter getSequence(key)` attempts to _»open« a data sequence,_ assuming that the
- ** \a key somehow links to data that can somehow be interpreted as a sequence of
- ** nested sub-data-entities. The result is expected as »[Lumiera Forward Iterator]«.
+ ** \a key somehow links to data that can be interpreted in a way to yield a sequence
+ ** of nested sub-data-entities. The result is expected as »[Lumiera Forward Iterator]«.
** - `DataSource openContext(Iter)` is supplied with the \a Iter from `getSequence()`
** and assumed to return a new data binding as `DataSource` object, tied to the nested
** data entity or context corresponding to the current »yield« of the Iterator. This
@@ -148,7 +148,7 @@
** \par ETD Binding
** While the _Map Binding_ detailed in the preceding paragraph is mostly intended to handle
** simple key substitutions, the more elaborate binding to `GenNode` data (ETD), which is
- ** provided in the separate header text-template-gen-node-binding.hpp, is meant to handle
+ ** provided in the separate header text-template-gen-node-binding.hpp, is meant to handle
** structural data, as encountered in the internal communication of components within the
** Lumiera application — notably the »diff binding« used to populate the GUI with entities
** represented in the _Session Model_ in Steam-Layer. The mapping is straight-forward, as the
@@ -470,9 +470,9 @@ namespace lib {
void
compile (PAR& parseIter, ActionSeq& actions)
{
- auto currIDX = [&]{ return actions.size(); };
- auto valid = [&](Idx i){ return 0 < i and i < actions.size(); };
- auto clause = [](Clause c)-> string { return c==IF? "if" : "for"; };
+ auto currIDX = [&]{ return actions.size(); };
+ auto valid = [&](Idx i){ return 0 < i and i < actions.size(); };
+ auto clause = [](Clause c)-> string { return c==IF? "if" : "for"; };
auto scopeClause = [&]{ return scope_.empty()? "??" : clause(scope_.top().clause); };
// Support for bracketing constructs (if / for)
diff --git a/src/steam/engine/node-builder.hpp b/src/steam/engine/node-builder.hpp
index 8d2605934..2136b7fae 100644
--- a/src/steam/engine/node-builder.hpp
+++ b/src/steam/engine/node-builder.hpp
@@ -93,7 +93,7 @@
#include "lib/error.hpp"
-#include "lib/symbol.hpp"
+//#include "lib/symbol.hpp"//////////////////////////////TODO RLY?
#include "lib/nocopy.hpp"
#include "steam/engine/weaving-pattern-builder.hpp"
#include "steam/engine/proc-node.hpp"
@@ -111,7 +111,7 @@ namespace steam {
namespace engine {
namespace err = lumiera::error;
- using lib::Literal;
+// using lib::Literal;
using util::_Fmt;
using std::forward;
using std::move;
@@ -156,18 +156,21 @@ namespace engine {
using LeadRefs = DataBuilder;
protected:
+ StrView symbol_;
LeadRefs leads_;
DAT patternData_;
public:
template
- NodeBuilder (INIT&& ...alloInit)
- : leads_{forward (alloInit)...}
+ NodeBuilder (StrView nodeSymbol, INIT&& ...alloInit)
+ : symbol_{nodeSymbol}
+ , leads_{forward (alloInit)...}
{ }
template
NodeBuilder (NodeBuilder&& pred, SizMark, BUILD&& entryBuilder)
- : leads_{move (pred.leads_)}
+ : symbol_{pred.symbol_}
+ , leads_{move (pred.leads_)}
, patternData_{move (pred.patternData_), forward (entryBuilder)}
{ }
@@ -207,7 +210,7 @@ namespace engine {
withAllocator (INIT&& ...alloInit)
{
using AllocatorPolicy = lib::allo::SetupSeveral;
- return NodeBuilder{forward(alloInit)...};
+ return NodeBuilder{symbol_, forward(alloInit)...};
}
@@ -247,7 +250,7 @@ namespace engine {
/** setup standard wiring to adapt the given processing function.
* @return a PortBuilder specialised to wrap the given \a FUN */
template
- auto invoke (Literal qualifier, FUN fun);
+ auto invoke (StrView portSpec, FUN fun);
/** specify an `InvocationAdapter` to use explicitly. */
template
@@ -375,9 +378,9 @@ namespace engine {
private:
template
- PortBuilder(_Par&& base, FUN&& fun, Literal qualifier)
+ PortBuilder(_Par&& base, FUN&& fun, StrView portSpec)
: _Par{move(base)}
- , weavingBuilder_{forward (fun), qualifier, _Par::leads_.policyConnect()}
+ , weavingBuilder_{forward (fun), _Par::symbol_, portSpec, _Par::leads_.policyConnect()}
, defaultPort_{_Par::patternData_.size()}
{ }
@@ -409,10 +412,10 @@ namespace engine {
template
template
auto
- PortBuilderRoot::invoke (Literal qualifier, FUN fun)
+ PortBuilderRoot::invoke (StrView portSpec, FUN fun)
{
using WeavingBuilder_FUN = WeavingBuilder(), FUN>;
- return PortBuilder{move(*this), move(fun), qualifier};
+ return PortBuilder{move(*this), move(fun), portSpec};
}
/*
template
@@ -431,9 +434,9 @@ namespace engine {
* any further specifications and data elements.
*/
inline auto
- prepareNode()
+ prepareNode (StrView nodeSymbol)
{
- return NodeBuilder{};
+ return NodeBuilder{nodeSymbol};
}
diff --git a/src/steam/engine/proc-id.hpp b/src/steam/engine/proc-id.hpp
index af4d079ba..110bcc0b4 100644
--- a/src/steam/engine/proc-id.hpp
+++ b/src/steam/engine/proc-id.hpp
@@ -53,12 +53,20 @@ namespace engine {
using lib::HashVal;
using std::string;
+ using StrView = std::string_view;
+
class ProcID
{
+ string nodeSymb_;
+ string portQual_;
+ string argLists_;
+
+ ProcID (StrView nodeSymb, StrView portQual, StrView argLists);
+
public:
/** build and register a processing ID descriptor */
- static ProcID& describe();
+ static ProcID& describe (StrView nodeSymb, StrView portSpec);
/* === symbolic descriptors === */
@@ -68,7 +76,17 @@ namespace engine {
return "Lalü";
}
- friend bool operator== (ProcID const& l, ProcID const& r) { return true; }
+ friend bool
+ operator== (ProcID const& l, ProcID const& r)
+ {
+ return l.nodeSymb_ == r.nodeSymb_
+ and l.portQual_ == r.portQual_
+ and l.argLists_ == r.argLists_;
+ }
+
+ friend bool
+ operator!= (ProcID const& l, ProcID const& r)
+ { return not (l == r); }
};
HashVal hash_value (ProcID const&);
diff --git a/src/steam/engine/proc-node.cpp b/src/steam/engine/proc-node.cpp
index d0a0e5ba8..9db39a554 100644
--- a/src/steam/engine/proc-node.cpp
+++ b/src/steam/engine/proc-node.cpp
@@ -33,8 +33,10 @@
#include "lib/format-string.hpp"
#include "lib/util.hpp"
+#include
#include
+
namespace steam {
namespace engine {
@@ -58,13 +60,18 @@ namespace engine {
* and retained until end of the Lumiera process (never deleted).
*/
ProcID&
- ProcID::describe()
+ ProcID::describe (StrView nodeSymb, StrView portSpec)
{
- auto res = procRegistry.emplace ();
+ auto res = procRegistry.insert (ProcID{"bla","blubb","murks"});
return unConst (*res.first);
}
/** @internal */
+ ProcID::ProcID (StrView nodeSymb, StrView portQual, StrView argLists)
+ : nodeSymb_{nodeSymb} /////////////////////////////////////////////////////////OOO intern these strings!!
+ , portQual_{portQual}
+ , argLists_{argLists}
+ { }
/** generate registry hash value based on the distinct data in ProcID.
* This function is intended to be picked up by ADL, and should be usable
diff --git a/src/steam/engine/weaving-pattern-builder.hpp b/src/steam/engine/weaving-pattern-builder.hpp
index 4f2a0d7c6..786b66cbe 100644
--- a/src/steam/engine/weaving-pattern-builder.hpp
+++ b/src/steam/engine/weaving-pattern-builder.hpp
@@ -122,12 +122,14 @@
#include
//#include
#include
+#include
namespace steam {
namespace engine {
namespace err = lumiera::error;
+ using StrView = std::string_view;
using std::forward;
using lib::Literal;
using lib::Several;
@@ -379,13 +381,15 @@ namespace engine {
Depend ctx;
- Literal qualifier_;
+ StrView nodeSymb_;
+ StrView portSpec_;
FUN fun_;
template
- WeavingBuilder(FUN&& init, Literal qual, INIT&& ...alloInit)
+ WeavingBuilder(FUN&& init, StrView nodeSymb, StrView portSpec, INIT&& ...alloInit)
: leadPorts{forward (alloInit)...}
- , qualifier_{qual}
+ , nodeSymb_{nodeSymb}
+ , portSpec_{portSpec}
, fun_{move(init)}
{ }
@@ -476,10 +480,11 @@ namespace engine {
,types = move(outTypes.build())
,procFun = move(fun_)
,resultIdx = resultSlot
+ ,procID = ProcID::describe (nodeSymb_,portSpec_)
]
(PortDataBuilder& portData) mutable -> void
{
- portData.template emplace (ProcID::describe()
+ portData.template emplace (procID
,move(leads)
,move(types)
,resultIdx
diff --git a/tests/core/steam/engine/node-linkage-test.cpp b/tests/core/steam/engine/node-linkage-test.cpp
index 085b04921..b860222de 100644
--- a/tests/core/steam/engine/node-linkage-test.cpp
+++ b/tests/core/steam/engine/node-linkage-test.cpp
@@ -71,7 +71,7 @@ namespace test {
void
build_connected_nodes()
{
- auto con = prepareNode()
+ auto con = prepareNode("Test:Src")
.preparePort()
.invoke(DUMMY_FUN_ID, dummyOp)
.completePort()
diff --git a/tests/core/steam/engine/test-rand-ontology.cpp b/tests/core/steam/engine/test-rand-ontology.cpp
index ddc59da85..9011a1b93 100644
--- a/tests/core/steam/engine/test-rand-ontology.cpp
+++ b/tests/core/steam/engine/test-rand-ontology.cpp
@@ -42,7 +42,7 @@ namespace test {
} // (End) hidden impl details
- Literal DUMMY_FUN_ID{"DummyFun"};
+ const string DUMMY_FUN_ID{"DummyFun"};
diff --git a/tests/core/steam/engine/test-rand-ontology.hpp b/tests/core/steam/engine/test-rand-ontology.hpp
index 309b17889..85eb49de3 100644
--- a/tests/core/steam/engine/test-rand-ontology.hpp
+++ b/tests/core/steam/engine/test-rand-ontology.hpp
@@ -30,23 +30,23 @@
#include "lib/error.hpp"
-#include "lib/symbol.hpp"
#include "steam/engine/testframe.hpp"
#include
+#include
namespace steam {
namespace engine{
namespace test {
- using lib::Literal;
+ using std::string;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Dummy / Placeholder
using NoArg = std::array;
using SoloArg = std::array;
- extern Literal DUMMY_FUN_ID;
+ extern const string DUMMY_FUN_ID;
/** @todo a placeholder operation to wire a prototypical render node
*/
diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm
index 1badeea47..2493c6bbe 100644
--- a/wiki/thinkPad.ichthyo.mm
+++ b/wiki/thinkPad.ichthyo.mm
@@ -13597,9 +13597,7 @@
-
-
-
+
für LocationSolver
@@ -13965,9 +13963,7 @@
-
-
-
+
not empty? UND
@@ -14865,9 +14861,7 @@
-
-
-
+
...und ich hab mir letzte Woche noch solche Vorwürfe gemacht,
@@ -16500,9 +16494,7 @@
-
-
-
+
...welches in eine Kind-Timeline absteigt,
@@ -19105,9 +19097,7 @@
-
-
-
+
auch hier mehrstufige Prüfung mit Hysterese...
@@ -47272,9 +47262,7 @@
-
-
-
+
muß DiffApplicationStrategy
@@ -47954,9 +47942,7 @@
-
-
-
+
throw when
@@ -48327,9 +48313,7 @@
-
-
-
+
dieser Ansatz löst tatsächlich das Problem,
@@ -48528,9 +48512,7 @@
-
-
-
+
...will sagen:
@@ -48917,9 +48899,7 @@
-
-
-
+
Problem: InteractionControl
@@ -90778,6 +90758,10 @@ Date: Thu Apr 20 18:53:17 2023 +0200
+
+
+
+
@@ -91615,8 +91599,8 @@ Date: Thu Apr 20 18:53:17 2023 +0200
-
-
+
+
@@ -91699,6 +91683,34 @@ Date: Thu Apr 20 18:53:17 2023 +0200
+
+
+
+
+
+ Beschluß: als string_view durch den Builder durchreichen
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ das heißt, es handelt sich definitiv nicht um Literal-Strings; zudem wollen wir die Spec ggfs. noch zerlegen und dann in eine Symbol-Table internen; insofern ist std::string_view der naheliegende Ansatz, da wir keine Inline-Storage durch x-fache Builder-Objekte durchschieben wollen, bloß um am Ende doch nur einen Teilstring in die Symboltabelle zu kopieren
+
+
+
+
+
+
+
@@ -91756,7 +91768,19 @@ Date: Thu Apr 20 18:53:17 2023 +0200
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -91781,7 +91805,16 @@ Date: Thu Apr 20 18:53:17 2023 +0200
-
+
+
+
+
+
+ std::string hat ja inzwischen ebenfalls inline-Storage für ca. 20 Zeichen oder so; zudem könnte man in ProcID selber dann eine std::string_view darauf speichern, damit wäre der Zusammenhang effizient und klar dokumentiert
+
+
+
+
@@ -91793,8 +91826,7 @@ Date: Thu Apr 20 18:53:17 2023 +0200
und auch ansonsten äquivalent zur Implementierung von lib::Symbol
-
-
+
@@ -91805,8 +91837,7 @@ Date: Thu Apr 20 18:53:17 2023 +0200
Ich sehe das als einen Laufzeit-Cache, der jederzeit regeneriert werden kann; er wird sich maximal mit den im Model verwendeten Processing-Funktions-Deskriptoren füllen
-
-
+
@@ -138403,6 +138434,13 @@ class Something
+
+
+
+
+
+
+
@@ -138419,6 +138457,7 @@ class Something
+