diff --git a/src/steam/engine/node-builder.hpp b/src/steam/engine/node-builder.hpp index 8a876c5bc..31509035c 100644 --- a/src/steam/engine/node-builder.hpp +++ b/src/steam/engine/node-builder.hpp @@ -456,6 +456,16 @@ namespace engine { }); } + template + auto + setParam (PAR v1, PARS ...vs) + { + return attachParamFun ([=](TurnoutSystem&) -> tuple + { + return std::make_tuple (v1,vs...); + }); + } + template auto retrieveParam (GET&& getter) diff --git a/src/vault/gear/job.h b/src/vault/gear/job.h index 1b936c6b8..4f913fc20 100644 --- a/src/vault/gear/job.h +++ b/src/vault/gear/job.h @@ -159,6 +159,10 @@ typedef lumiera_jobDefinition* LumieraJobDefinition; * the referred LumieraJobClosure needs to be allocated * and managed separately. Indeed, this closure happens * to live within the segment data, as part of the JobTicket. + * @deprecated 2024 this was an early draft which actually was never expanded upon. + * At that time, the Scheduler was seen as an interface to the (then) "Backend" + * Structures in the Engine are meanwhile arranged differently, and this inteface + * will be removed soon... */ struct lumiera_jobDescriptor_struct { diff --git a/tests/core/steam/engine/node-devel-test.cpp b/tests/core/steam/engine/node-devel-test.cpp index 565c94bf5..1c4d5be91 100644 --- a/tests/core/steam/engine/node-devel-test.cpp +++ b/tests/core/steam/engine/node-devel-test.cpp @@ -19,7 +19,9 @@ #include "lib/test/run.hpp" #include "lib/hash-combine.hpp" #include "lib/test/test-helper.hpp" -#include "steam/engine/test-rand-ontology.hpp" ///////////TODO +#include "steam/engine/node-builder.hpp" +#include "steam/engine/test-rand-ontology.hpp" +#include "steam/engine/diagnostic-buffer-provider.hpp" #include "lib/test/diagnostic-output.hpp"/////////////////TODO #include "lib/iter-zip.hpp" #include "lib/random.hpp" @@ -30,6 +32,8 @@ using lib::zip; using lib::izip; using std::vector; +using std::make_tuple; +using lib::test::showType; namespace steam { @@ -281,6 +285,49 @@ namespace test { auto spec = testRand().setupGenerator(); SHOW_EXPR(spec.PROTO); CHECK (spec.PROTO == "generate-TestFrame"_expect); +SHOW_EXPR(spec.describe()) + auto procFun = spec.makeFun(); + using Sig = lib::meta::_Fun::Sig; +SHOW_EXPR(showType()) + CHECK (showType() == "void (tuple, engine::test::TestFrame*)"_expect); + + // Behaves identical to processing_generateFrame() + size_t frameNr = defaultGen.u64(); + uint flavour = defaultGen.u64(); + + Buffer buff; + CHECK (not buff->isSane()); + + procFun (make_tuple (frameNr,flavour), buff); + CHECK ( buff->isSane()); + CHECK ( buff->isPristine()); + CHECK (*buff == TestFrame(frameNr,flavour)); + + ProcNode node{prepareNode("Test") + .preparePort() + .invoke(spec.describe(), procFun) + .setParam(frameNr,flavour) + .completePort() + .build()}; + +SHOW_EXPR(watch(node).getPortSpec(0)) + CHECK (watch(node).getPortSpec(0) == "Test(TestFrame)"_expect); + + BufferProvider& provider = DiagnosticBufferProvider::build(); + BuffHandle buffHandle = provider.lockBuffer (provider.getDescriptorFor(sizeof(TestFrame))); + + uint port{0}; + + CHECK (not buffHandle.accessAs().isSane()); + + // Trigger Node invocation... + buffHandle = node.pull (port, buffHandle, Time::ZERO, ProcessKey{0}); + + TestFrame& result = buffHandle.accessAs(); + CHECK (result.isSane()); + CHECK (result.isPristine()); + CHECK (result == *buff); + buffHandle.release(); } }; diff --git a/tests/core/steam/engine/test-rand-ontology.cpp b/tests/core/steam/engine/test-rand-ontology.cpp index 387bbdf0d..bc029e9e1 100644 --- a/tests/core/steam/engine/test-rand-ontology.cpp +++ b/tests/core/steam/engine/test-rand-ontology.cpp @@ -38,6 +38,12 @@ namespace engine{ namespace test { // namespace err = lumiera::error; + using ont::FraNo; + using ont::ChaNo; + using ont::Flavr; + using ont::Factr; + using ont::Param; + namespace { // hidden local support facilities.... } // (End) hidden impl details @@ -53,7 +59,7 @@ namespace test { * @param flavour a further seed parameter to determine the actual (reproducibly) random data */ void - generateFrame (TestFrame* buff, size_t frameNr, uint flavour) + generateFrame (TestFrame* buff, FraNo frameNr, Flavr flavour) { REQUIRE (buff); new(buff) TestFrame{uint(frameNr), flavour}; @@ -70,7 +76,7 @@ namespace test { * which will be offset commonly by adding the \a flavour parameter. */ void - generateMultichan (TestFrame* buffArry, uint chanCnt, size_t frameNr, uint flavour) + generateMultichan (TestFrame* buffArry, ChaNo chanCnt, FraNo frameNr, Flavr flavour) { REQUIRE (buffArry); for (uint i=0; idata64().size(); @@ -126,7 +132,7 @@ namespace test { * by hash-chaining with \a param. The generated result is marked with a valid checksum. */ void - manipulateFrame (TestFrame* out, TestFrame const* in, uint64_t param) + manipulateFrame (TestFrame* out, TestFrame const* in, Param param) { REQUIRE (in); REQUIRE (out); @@ -145,7 +151,7 @@ namespace test { * each result byte is the linear interpolation between the corresponding inputs. */ void - combineFrames (TestFrame* out, TestFrame const* srcA, TestFrame const* srcB, double mix) + combineFrames (TestFrame* out, TestFrame const* srcA, TestFrame const* srcB, Factr mix) { REQUIRE (srcA); REQUIRE (srcB); diff --git a/tests/core/steam/engine/test-rand-ontology.hpp b/tests/core/steam/engine/test-rand-ontology.hpp index 7ff9a047f..e0a64f343 100644 --- a/tests/core/steam/engine/test-rand-ontology.hpp +++ b/tests/core/steam/engine/test-rand-ontology.hpp @@ -24,38 +24,63 @@ #include "lib/symbol.hpp" #include "lib/depend.hpp" #include "lib/nocopy.hpp" +#include "lib/format-obj.hpp" #include "lib/format-string.hpp" #include "steam/engine/testframe.hpp" #include +#include #include +#include +#include namespace steam { namespace engine{ namespace test { + using std::tuple; using std::string; using lib::Literal; + using std::shared_ptr; + using std::make_shared; + using std::forward; + using std::move; using util::_Fmt; + using util::toString; + + /** + * Test-Rand-Ontology : definition structures similar to a media-library + */ + namespace ont { + + using FraNo = size_t; + using ChaNo = uint; + using Flavr = uint; + using Factr = double; + using Param = uint64_t; + + const Literal TYPE_TESTFRAME{"TestFrame"}; ///< a stream implementation type with a frame of reproducible random data + } + /** produce sequences of frames with (reproducible) random data */ - void generateFrame (TestFrame* buff, size_t frameNr =0, uint flavour =0); + void generateFrame (TestFrame* buff, ont::FraNo frameNr =0, ont::Flavr flavour =0); /** produce planar multi channel output of random data frames */ - void generateMultichan (TestFrame* buffArry, uint chanCnt, size_t frameNr =0, uint flavour =0); + void generateMultichan (TestFrame* buffArry, ont::ChaNo chanCnt, ont::FraNo frameNr =0, ont::Flavr flavour =0); /** create an identical clone copy of the planar multi channel frame array */ - void duplicateMultichan (TestFrame* outArry, TestFrame* inArry, uint chanCnt); + void duplicateMultichan (TestFrame* outArry, TestFrame* inArry, ont::ChaNo chanCnt); /** »process« a planar multi channel array of data frames in-place */ - void manipulateMultichan (TestFrame* buffArry, uint chanCnt, uint64_t param); + void manipulateMultichan (TestFrame* buffArry, ont::ChaNo chanCnt, ont::Param param); /** »process« random frame date by hash-chaining with a parameter */ - void manipulateFrame (TestFrame* out, TestFrame const* in, uint64_t param); + void manipulateFrame (TestFrame* out, TestFrame const* in, ont::Param param); /** mix two random data frames by a parameter-controlled proportion */ - void combineFrames (TestFrame* out, TestFrame const* srcA, TestFrame const* srcB, double mix); + void combineFrames (TestFrame* out, TestFrame const* srcA, TestFrame const* srcB, ont::Factr mix); @@ -73,6 +98,7 @@ namespace test { UNIMPLEMENTED ("a sincerely nonsensical operation"); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Dummy / Placeholder + /** * A fake _Domain Ontology_ to describe mocked »render operations« on * dummy data frames filled with random numbers. @@ -88,10 +114,13 @@ namespace test { public: struct Spec; + template + class Builder; + ~TestRandOntology() = default; TestRandOntology() = default; - Spec setupGenerator (string qual =""); + auto setupGenerator (string qual =""); private: }; @@ -100,19 +129,85 @@ namespace test { : util::Cloneable { const string PROTO; + const string BASE_TYPE; Spec (Literal kind ,Literal type ) : PROTO{_Fmt{"%s-%s"} % kind % type} + , BASE_TYPE{type} { } }; - inline TestRandOntology::Spec + template + class TestRandOntology::Builder + : public Spec + { + shared_ptr conf_; + + public: + template + Builder (Spec spec, INIT&& ...init) + : Spec{move(spec)} + , conf_{make_shared (spec, forward (init)...)} + { } + + auto + makeFun() + { + return conf_->binding(); + } + + string + describe() + { + return conf_->procSpec(); + } + }; + + + namespace ont { + using Spec = TestRandOntology::Spec; + + /** extended config for Generator operations */ + struct ConfGen + { + using Param = tuple; + + ont::Flavr fOff = 0; + string streamType; + + ConfGen(Spec const& spec) + : streamType{spec.BASE_TYPE} + { } + + auto + binding() + { + return [offset = fOff] + (Param par, TestFrame* out) + { + auto [frameNr,flavour] = par; + generateFrame (out, frameNr, flavour+offset); + }; + } + + string + procSpec() + { + return _Fmt{"%s(%s)"} + % (fOff? toString(fOff):"") + % streamType; + } + }; + } + + inline auto TestRandOntology::setupGenerator (string qual) { - Spec spec{"generate","TestFrame"}; - return spec; + Spec spec{"generate", ont::TYPE_TESTFRAME}; + Builder builder{spec}; + return builder; } /** Singleton accessor */ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index db33a0280..98e1e2906 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -82302,7 +82302,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -82346,7 +82346,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -82373,7 +82373,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83110,8 +83110,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -87440,8 +87440,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -89647,7 +89647,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
diese wird vom Builder interpretiert
  • - und es demzufolge werden direkte Bau-Instruktionen gegeben + und demzufolge werden direkte Bau-Instruktionen gegeben
  • @@ -90981,18 +90981,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - - - - - - + + + + + + - + @@ -91052,13 +91051,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + - + @@ -91076,8 +91075,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + @@ -91085,7 +91084,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -91105,7 +91104,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -91208,15 +91207,15 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - - + + + - + @@ -91405,7 +91404,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -91414,16 +91413,16 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + - - + + @@ -91885,7 +91884,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -94346,17 +94345,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - +
    + - - + @@ -94413,7 +94412,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -94537,8 +94536,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + @@ -94766,7 +94765,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -94870,7 +94869,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -96430,13 +96429,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + - + - + + @@ -96476,8 +96476,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + @@ -97572,7 +97572,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -97745,9 +97745,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + - + @@ -97846,10 +97846,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + - + @@ -98352,7 +98352,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -98511,9 +98511,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + + @@ -98637,7 +98637,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -98690,6 +98690,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + @@ -98771,14 +98772,14 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - - + + - + @@ -98814,8 +98815,11 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + - + + @@ -99298,10 +99302,10 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - + @@ -99311,7 +99315,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -99319,6 +99323,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + @@ -99380,7 +99387,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -99409,7 +99416,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -99524,6 +99531,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + @@ -99567,8 +99575,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -99580,6 +99588,27 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + + + +

    + herausfinden wie ein API für Tests sinnvollerweise aufgebaut werden kann... +

    + + +
    + + + + + + + + +
    @@ -99711,7 +99740,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -100206,8 +100235,8 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + @@ -100230,7 +100259,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -100238,7 +100267,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -100264,8 +100293,40 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -100275,8 +100336,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - + + + @@ -100323,6 +100385,51 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -100332,9 +100439,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + + @@ -100423,9 +100530,9 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - - - + + + @@ -100434,11 +100541,11 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)

    - + - + - + @@ -100596,7 +100703,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -100626,9 +100733,20 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + + + + + +

    + es bleibt zu klären: was stellt das Turnout-System dar? +

    + + +
    - + @@ -100968,6 +101086,10 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)
    + + + +
    @@ -101649,7 +101771,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + @@ -102061,11 +102183,11 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - - + +