Invocation: cover dissecting of ProcID spec

..with some slight changes
 * also recognise domain prefix
 * omit domain prefix in proc-name
This commit is contained in:
Fischlurch 2025-01-11 22:17:07 +01:00
parent 6207f475eb
commit 55ad44590c
4 changed files with 69 additions and 19 deletions

View file

@ -109,7 +109,7 @@ namespace engine {
*/
class ProcID
{
StrView nodeSymb_;
StrView nodeName_;
StrView portQual_;
StrView argLists_;
ProcAttrib attrib_{};
@ -127,14 +127,17 @@ namespace engine {
string genProcName();
string genProcSpec(); ///< render a descriptor for the operation (without predecessors)
string genQualifier();
string genNodeName();
string genNodeSymbol();
string genNodeDomain();
string genNodeSpec(Leads&);
string genSrcSpec (Leads&); ///< transitively enumerate all unique source nodes
friend bool
operator== (ProcID const& l, ProcID const& r)
{
return l.nodeSymb_ == r.nodeSymb_
return l.nodeName_ == r.nodeName_
and l.portQual_ == r.portQual_
and l.argLists_ == r.argLists_
and l.attrib_ == r.attrib_;

View file

@ -81,7 +81,7 @@ namespace engine {
ProcID& entry{unConst (*res.first)};
if (res.second)
{// new record placed into the registry
dedupSymbol (entry.nodeSymb_);
dedupSymbol (entry.nodeName_);
dedupSymbol (entry.argLists_);
if (not isnil(entry.portQual_))
dedupSymbol (entry.portQual_);
@ -91,7 +91,7 @@ namespace engine {
/** @internal */
ProcID::ProcID (StrView nodeSymb, StrView portQual, StrView argLists)
: nodeSymb_{nodeSymb}
: nodeName_{nodeSymb}
, portQual_{portQual}
, argLists_{argLists}
{ }
@ -104,7 +104,7 @@ namespace engine {
HashVal
hash_value (ProcID const& procID)
{
HashVal hash = boost::hash_value (procID.nodeSymb_); ///////////////////////////////////////////////////TICKET #1391 : which technology to use for processing-ID hashes -> cache keys?
HashVal hash = boost::hash_value (procID.nodeName_); ///////////////////////////////////////////////////TICKET #1391 : which technology to use for processing-ID hashes -> cache keys?
if (not isnil(procID.portQual_))
hash_combine (hash, procID.portQual_); ////////////////////////////////////////////////////////TICKET #1391 : should use lib/hash-combine.hpp (stable, but not portable!)
hash_combine (hash, procID.argLists_);
@ -115,9 +115,8 @@ namespace engine {
ProcID::genProcName()
{
std::ostringstream buffer;
buffer << nodeSymb_;
if (not isnil(portQual_))
buffer << '.' << portQual_;
buffer << genNodeSymbol()
<< genQualifier();
return buffer.str();
}
@ -125,17 +124,41 @@ namespace engine {
ProcID::genProcSpec()
{
std::ostringstream buffer;
buffer << nodeSymb_;
if (not isnil(portQual_))
buffer << '.' << portQual_;
buffer << argLists_;
buffer << nodeName_
<< genQualifier()
<< argLists_;
return buffer.str();
}
string
ProcID::genNodeName()
{
return string{nodeSymb_};
return string{nodeName_};
}
string
ProcID::genNodeSymbol()
{
auto p = nodeName_.find(':');
return p == string::npos? string{nodeName_}
: string{nodeName_.substr(p+1)};
}
string
ProcID::genNodeDomain()
{
auto p = nodeName_.find(':');
return p == string::npos? string{}
: string{nodeName_.substr(0,p)};
}
string
ProcID::genQualifier()
{
std::ostringstream buffer;
if (not isnil(portQual_))
buffer << '.' << portQual_;
return buffer.str();
}
@ -152,7 +175,7 @@ namespace engine {
ProcID::genNodeSpec (Leads& leads)
{
std::ostringstream buffer;
buffer << nodeSymb_;
buffer << nodeName_;
if (1 != leads.size())
buffer << genSrcSpec(leads);
else
@ -174,7 +197,7 @@ namespace engine {
explore(leads)
.expandAll([](ProcNode& n){ return explore(watch(n).leads()); }) // depth-first expand all predecessors
.filter ([](ProcNode& n){ return watch(n).isSrc(); }) // but retain only leafs (≙ source nodes)
.transform([](ProcNode& n){ return procID(n).nodeSymb_;}) // render the node-symbol of each src
.transform([](ProcNode& n){ return procID(n).nodeName_;}) // render the node-symbol of each src
.deduplicate()) // sort and deduplicate
+ "}";
}
@ -231,7 +254,7 @@ namespace engine {
string
PortDiagnostic::getProcSpec()
{
p_.procID.genProcSpec();
return p_.procID.genProcSpec();
}
HashVal

View file

@ -50,14 +50,32 @@ namespace test {
/** @test TODO evaluation of processing-spec for a ProcID
* @todo WIP 1/25 🔁 define implement
* @todo WIP 1/25 🔁 define 🔁 implement
*/
void
verify_ID_specification()
{
auto& p1 = ProcID::describe("N1","(arg)");
auto& p2 = ProcID::describe("N1","(a1,a2)");
auto& p3 = ProcID::describe("N1","(in/3)(o1,o2/2)");
auto& p2 = ProcID::describe("U:N2","+(a1,a2)");
auto& p3 = ProcID::describe("O:N3","(in/3)(o1,o2/2)");
CHECK (p1.genNodeName() == "N1"_expect );
CHECK (p1.genNodeSymbol() == "N1"_expect );
CHECK (p1.genNodeDomain() == ""_expect );
CHECK (p2.genNodeName() == "U:N2"_expect );
CHECK (p2.genNodeSymbol() == "N2"_expect );
CHECK (p2.genNodeDomain() == "U"_expect );
CHECK (p3.genNodeName() == "O:N3"_expect );
CHECK (p3.genNodeSymbol() == "N3"_expect );
CHECK (p3.genNodeDomain() == "O"_expect );
CHECK (p1.genProcName() == "N1"_expect );
CHECK (p1.genQualifier() == ""_expect );
CHECK (p2.genProcName() == "N2.+"_expect ); // domain omitted, qualifier joined with '.'
CHECK (p2.genQualifier() == ".+"_expect ); // qualifier includes leading '.'
CHECK (p3.genProcName() == "N3"_expect );
CHECK (p2.genProcSpec() == "U:N2.+(a1,a2)"_expect );
CHECK (p3.genProcSpec() == "O:N3(in/3)(o1,o2/2)"_expect );
UNIMPLEMENTED ("parse and evaluate");
}

View file

@ -102421,6 +102421,12 @@ StM_bind(Builder&lt;R1&gt; b1, Extension&lt;R1,R2&gt; extension)
<icon BUILTIN="flag-pink"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1736610754727" ID="ID_575487435" LINK="#ID_25381362" MODIFIED="1736611024745" TEXT="Grobstruktur zerlegen">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1736629324669" ID="ID_127221331" MODIFIED="1736629345486" TEXT="f&#xfc;hre noch Trennund in Node-Domain und Symbol ein">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1736629347033" ID="ID_1555708215" MODIFIED="1736629384736" TEXT="Namen werden &#xbb;sanitised&#xab; ">
<icon BUILTIN="flag-pink"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1736610781361" ID="ID_1231919908" LINK="#ID_25381362" MODIFIED="1736611024747" TEXT="Argument-Listen parsen">
<icon BUILTIN="flag-yellow"/>