From 4b6d81257891156d671fb93378e49c7d6c1d9a97 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 3 Nov 2024 21:03:34 +0100 Subject: [PATCH] Invocation: provide access to a deduplicated `ProcID` ...as follow-up to yesterday's decisions - each Port will just feature a (stable) reference to a ProcID record - which is deduplicated and likewise refers to deduplicated symbolic tags - and further spec and hash values are computed on-demand by this entity __Note__: all functionality belonging to the ''Builder'' can be assumed to run **non-concurrent** --- src/lib/symbol-impl.cpp | 4 +- src/lib/symbol-table.hpp | 4 +- src/lib/symbol.hpp | 4 +- src/steam/engine/proc-id.hpp | 19 +++- src/steam/engine/proc-node.cpp | 35 +++++++- wiki/thinkPad.ichthyo.mm | 160 ++++++++++++++------------------- 6 files changed, 122 insertions(+), 104 deletions(-) diff --git a/src/lib/symbol-impl.cpp b/src/lib/symbol-impl.cpp index 28f9c0feb..f3044610f 100644 --- a/src/lib/symbol-impl.cpp +++ b/src/lib/symbol-impl.cpp @@ -109,7 +109,7 @@ namespace lib { * This function is intended to be picked up by ADL, and should be usable * both with `std::hash` and ``. It is implemented * similar as the boost::hash specialisation for std::string */ - size_t + HashVal hash_value (Literal literal) { size_t hash=0; @@ -125,7 +125,7 @@ namespace lib { } /** hash value for Symbols is directly based on the symbol table entry */ - size_t + HashVal hash_value (Symbol sym) { return sym? boost::hash_value (sym.c()) diff --git a/src/lib/symbol-table.hpp b/src/lib/symbol-table.hpp index fabc26c04..ada73a77b 100644 --- a/src/lib/symbol-table.hpp +++ b/src/lib/symbol-table.hpp @@ -60,7 +60,7 @@ namespace lib { using std::string; - using std::forward; + using std::move; /** @@ -81,7 +81,7 @@ namespace lib { internedString (string && symbolString) { Lock sync{this}; - auto res = table_.insert (forward (symbolString)); + auto res = table_.insert (move (symbolString)); return res.first->c_str(); } }; diff --git a/src/lib/symbol.hpp b/src/lib/symbol.hpp index 95fc84a8d..dc554d34b 100644 --- a/src/lib/symbol.hpp +++ b/src/lib/symbol.hpp @@ -179,8 +179,8 @@ namespace lib { /* ===== to be picked up by ADL ===== */ - size_t hash_value (Literal); - size_t hash_value (Symbol); + HashVal hash_value (Literal); + HashVal hash_value (Symbol); /* === equality comparisons === */ diff --git a/src/steam/engine/proc-id.hpp b/src/steam/engine/proc-id.hpp index eca1a5800..af4d079ba 100644 --- a/src/steam/engine/proc-id.hpp +++ b/src/steam/engine/proc-id.hpp @@ -33,30 +33,47 @@ ** ** @see turnout.hpp ** @see engine::ProcNodeDiagnostic + ** @see proc-node.cpp for the implementation backend */ #ifndef ENGINE_PROC_ID_H #define ENGINE_PROC_ID_H +#include "lib/hash-standard.hpp" #include "lib/error.hpp" -#include "lib/hash-value.h" //#include "steam/streamtype.hpp" +#include + namespace steam { namespace engine { namespace err = lumiera::error; using lib::HashVal; + using std::string; class ProcID { public: /** build and register a processing ID descriptor */ static ProcID& describe(); + + /* === symbolic descriptors === */ + + string + genProcSpec() + { + return "Lalü"; + } + + friend bool operator== (ProcID const& l, ProcID const& r) { return true; } }; + HashVal hash_value (ProcID const&); + + }} // namespace steam::engine #endif /*ENGINE_PROC_ID_H*/ diff --git a/src/steam/engine/proc-node.cpp b/src/steam/engine/proc-node.cpp index 6e499bd1b..d0a0e5ba8 100644 --- a/src/steam/engine/proc-node.cpp +++ b/src/steam/engine/proc-node.cpp @@ -30,13 +30,19 @@ #include "steam/engine/proc-id.hpp" #include "steam/engine/proc-node.hpp" +#include "lib/format-string.hpp" +#include "lib/util.hpp" + +#include namespace steam { namespace engine { + using util::unConst; namespace { // Details... - + + std::unordered_set procRegistry; } // (END) Details... @@ -46,14 +52,31 @@ namespace engine { Port::~Port() { } ///< @remark VTables for the Port-Turnout hierarchy emitted from \ref proc-node.cpp + /** + * @remark this is the only public access point to ProcID entries, + * which are automatically deduplicated and managed in a common registry + * and retained until end of the Lumiera process (never deleted). + */ ProcID& ProcID::describe() { - UNIMPLEMENTED ("establish and possibly enrol new processing descriptor"); + auto res = procRegistry.emplace (); + return unConst (*res.first); } /** @internal */ + /** 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 + * both with `std::hash` and ``. + */ + HashVal + hash_value (ProcID const& procID) + { + return 47; //UNIMPLEMENTED ("ProcID hash"); + } + + string ProcNodeDiagnostic::getNodeSpec() { @@ -66,10 +89,16 @@ namespace engine { UNIMPLEMENTED ("calculate an unique hash-key to designate this node"); } + /** + * @return symbolic string with format `NodeSymb[.portQualifier](inType[/#][,inType[/#]])(outType[/#][,outType[/#]][ >N])` + * @remark information presented here is passed-through from builder Level-3, based on semantic markup present there + */ string ProcNodeDiagnostic::getPortSpec (uint portIdx) { - UNIMPLEMENTED ("generate a descriptive diagnostic Spec for the designated Turnout"); + auto& p{n_.wiring_.ports}; + return p.size() < portIdx? util::FAILURE_INDICATOR + : p[portIdx].procID.genProcSpec(); } HashVal diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 0b8127980..1badeea47 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -13507,9 +13507,7 @@ - - - +

auto locate = matchView( @@ -13526,9 +13524,7 @@ - - - +

LocatorSpec<UIC_VIEW> locate = panel("blah") @@ -13542,9 +13538,7 @@ - - - +

ViewSpec locate = panel("blah") @@ -14149,9 +14143,7 @@ - - - +

nur "hinten herum" über die verwendete LocationQuery @@ -14339,9 +14331,7 @@ - - - +

nämlich in lib::meta::func::PApply::bindBack @@ -14409,9 +14399,7 @@ - - - +

Vermutung: muß Lambda instantiieren... @@ -15546,9 +15534,7 @@ - - - +

...es ist im Rahmen; @@ -15579,9 +15565,7 @@ - - - +

wir brauchen keine Token @@ -15654,9 +15638,7 @@ - - - +

...wir brauchen eine Repräsentation, @@ -15776,9 +15758,7 @@ - - - +

alloc = unlimited @@ -15794,9 +15774,7 @@ - - - +

alloc = onlyOne @@ -15948,9 +15926,7 @@ - - - +

was hier vielleicht der Fall sein könnte @@ -15986,9 +15962,7 @@ - - - +

wir haben nicht einfach UI-Coordinaten als DSl-Elemente, @@ -16045,9 +16019,7 @@ - - - +

Schicht unter dem ViewLocator @@ -18297,9 +18269,7 @@ - - - +

ElementBoxWidget::Config::buildLayoutStrategy(ElementBoxWidget&) @@ -18412,9 +18382,7 @@ - - - +

  • @@ -18460,9 +18428,7 @@ - - - +

    ...und das ist vielleicht sogar eine gute Idee: Lumiera könnte die Möglichkeit bieten, jedwedes Element eigens für sich darzustellen oder zu inspizieren, transient und ohne Seiteneffekte @@ -18482,9 +18448,7 @@ - - - +

    veränderte Menü-Steuerung bei derartiger Degradierung @@ -18494,9 +18458,7 @@ - - - +

    das bedeutet: es ist Aufgabe eines übergeordneten Layout-Managers, dann auch ein reduziertes Display zu schalten; das ElementBoxWidget kann davon ausgehen, den minimal benötigten Platz auch zu bekommen (size request) @@ -18517,9 +18479,7 @@ - - - +

    im Besonderen keine Border! @@ -18581,9 +18541,7 @@ - - - +

    • @@ -18622,9 +18580,7 @@ - - - +

      ...insofern dann die Beschränkung der Ausdehnung einzig dadurch aktiviert werden kann, daß man ein geeignetes Verb angibt, welches diese beiden Lambda als Argument nimmt @@ -18634,9 +18590,7 @@ - - - +

      ...und ich muß die Frage, wann genau diese Info bezogen wird, überhaupt nicht klären @@ -18646,9 +18600,7 @@ - - - +

      wobei letztlich nur ein queue_resize erfolgen muß; es könnte also sein, daß dafür der Aufruf einer bestehenden GTK-Funktion genügt @@ -47548,9 +47500,7 @@ - - - +

      Diff kennt keine Zuweisung @@ -48134,9 +48084,7 @@ - - - +

      stellt sich u.U erst während der Verarbeitung heraus: @@ -48491,9 +48439,7 @@ - - - +

      noch zusätzlich zur genannten Duplikation muß @@ -48821,9 +48767,7 @@ - - - +

      ...und diesen mit VTable bestücken. @@ -49117,9 +49061,7 @@ - - - +

      hier geht es darum, eine Regel zu generieren, @@ -78272,8 +78214,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
      - + @@ -91821,10 +91763,41 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
      - - + + + + - + + + + + + + +

      + ...das nicht die allgemeine Symbol-Tabelle flutet; auch kann man damit später den tatsächlichen Speicherbedarf besser beurteilen +

      + +
      +
      + + + + + +

      + #include "lib/hash-standard.hpp" +

      +

      + und auch ansonsten äquivalent zur Implementierung von lib::Symbol +

      + + +
      +
      +
      + @@ -93376,8 +93349,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
      - + @@ -133253,8 +133226,7 @@ std::cout << tmpl.render({"what", "World"}) << s Frame-Cache (Service)

      - - +