From 479ab8cb15ce7578dc72c9f49f862f683b5cd13f Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 19 Dec 2024 22:35:12 +0100 Subject: [PATCH] Invocation: decision logic for invoking a ''parameter functor'' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on the usage concept developed thus far, we rely on a `FeedPrototype` to generate the actual `FeedManifold` for each invocation — and this is the extension point where a ''parameter functor'' can be attached. Notably, such a parameter functor will be configured from a different part of the builder logic than the underlying processing function, which is adapted by a Library Plug-in. Parameters on the other hand will be controlled mostly by configuration within the Session, because the user chooses to use specific settings, e.g. for an effect. An important extension to this scheme is **Parameter Automation** — which will be also attached over the extension point designed here. Since Parameter can be defined in various flavours, there is some concern that we'll end up with an excessive number of template instantiations. Thus, we'll explicitly create a »loop hole« by allowing to define the ''parameter functor'' to be a `std::function`. This would open a secondary possibility: configuring such a function, but leaving it empty, which would be a further control switch usable by the builder. --- src/steam/engine/feed-manifold.hpp | 51 ++++++++++ wiki/thinkPad.ichthyo.mm | 158 +++++++++++++++++++---------- 2 files changed, 153 insertions(+), 56 deletions(-) diff --git a/src/steam/engine/feed-manifold.hpp b/src/steam/engine/feed-manifold.hpp index fb4804901..0d5383ca9 100644 --- a/src/steam/engine/feed-manifold.hpp +++ b/src/steam/engine/feed-manifold.hpp @@ -117,11 +117,13 @@ namespace engine { using lib::meta::ElmTypes; using lib::meta::Tagged; using lib::meta::TySeq; + using std::declval; using std::is_pointer; using std::is_reference; using std::remove_reference_t; using std::remove_pointer_t; using std::tuple_element_t; + using std::void_t; using std::__and_; using std::__not_; @@ -244,6 +246,44 @@ namespace engine { using BuffI = typename std::conditional::type; /////////////////////////TODO obsolete ... remove after switch }; + + /** + * Trait template to handle an _associated parameter functor._ + * In those cases, where the basic processing function is classified such + * as to accept parameter(s), it may be desirable to _generate_ those parameters + * at invocation — be it as a fixed parametrisation chosen for this usage, or even + * by evaluation of an _Automation function_ for some parameters. + * @tparam FUN type of the underlying _processing function_ + */ + template + struct _ParamFun + { + using _Proc = _ProcFun; + + static constexpr bool hasParam() { return _Proc::hasParam(); } + + using Param = std::conditional_t>; + + template + using isSuitable = std::is_constructible (std::declval()))>; + + template + using isConfigurable = std::is_constructible; + + template + static bool + isActivated (PF const& paramFun) + { + if constexpr (isSuitable()) + { if constexpr (isConfigurable()) + return bool(paramFun); + else + return true; + } + return false; + } + }; + }//(End)Introspection helpers. @@ -485,9 +525,20 @@ namespace engine { class FeedPrototype : util::MoveOnly { + using _Trait = _ParamFun; + using Feed = FeedManifold; + FUN procFun_; PAM paramFun_; + Feed + createFeed (TurnoutSystem& turnoutSys) + { + if constexpr (_Trait::hasParam()) + if (_Trait::isActivated(paramFun_)) + return Feed{paramFun_(turnoutSys), procFun_}; + return Feed{procFun_}; + } ///////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1386 : elaborate setup / binding for parameter-creation }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index f9e5a67eb..16bcbd002 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -26380,9 +26380,7 @@ - - - +

es ist auf nein hinausgelaufen.... @@ -26987,9 +26985,7 @@ - - - +

Anweisungen in der Statuszeile: wähle ersten Punkt, setze zweiten Punkt.... @@ -27692,9 +27688,7 @@ - - - +

mache hier die vereinfachtende Annahme, daß alle Brackets die gleiche Metrik haben @@ -28409,9 +28403,7 @@ - - - +

....ob es was sinnvolles in einem Overview-Ruler anzuzeigen gibt @@ -29332,9 +29324,7 @@ - - - +

  1. @@ -29615,9 +29605,7 @@ - - - +

    Empfänger(»Slot«): TimelineLayout::sizeZoomWindow (Gtk::Allocation&) @@ -31856,9 +31844,7 @@ - - - +

    rein gefühlsmäßig wäre aber vorher wohl geschickter @@ -32230,9 +32216,7 @@ - - - +

    weil über alles andere darübergezeichnet wird @@ -33732,9 +33716,7 @@ - - - +

    sichtbar an der Höhe der Sub-Scope-Verbindungen auf den StaveBrackets @@ -34652,9 +34634,7 @@ - - - +

    Aufgabe: wie geht man mit einem Anzeigestil um, der den Effkt gar nicht  darstellt @@ -35031,9 +35011,7 @@ - - - +

    ...das ist eine grundlegende Design-Enscheidung (und zwar eine Gute), aber in der Praxis muß es natürlich trotzdem einen Weg geben, nur ist der dann relativ indirekt und auch nicht wirklich dokumentiert @@ -35538,9 +35516,7 @@ - - - +

    ...anstatt eine auf den konkreten Typ getemplatete Subklasse zu verwenden, @@ -88388,8 +88364,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + @@ -88777,7 +88753,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - +
    @@ -92053,8 +92029,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + @@ -92069,7 +92045,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -92087,7 +92063,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -92123,8 +92099,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    enable_if_hasParam : verwendet statt Type statt type

    - -
    +
    @@ -92328,12 +92303,83 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + + + + + + + + + +

    + ....das heißt, alle wichtigen Eigenschaften aus _ProcFun<FUN> müssen delegiert bereitgestellt werden... +

    + + +
    +
    - + + + + + + + + + + +

    + valide  ⟹  Funktor ist brauchbar +

    + + +
    +
    +
    + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + +

    + ...die werde ich voraussichtlich per Default (oder zumindest in wichtigen Fällen) einsetzen, um den Template-Bloat zu begrenzen. Das hat dann zur Folge, daß noch zur Laufzeit entschieden werden könnte, ob überhaupt eine Parameter-Konfiguration gemacht wird, oder ob default-konstruierte Parameter-Werte genügen +

    + +
    + +
    + + + +
    @@ -92839,9 +92885,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - - + + +
    @@ -92857,14 +92903,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + - - + +