diff --git a/src/steam/engine/feed-manifold.hpp b/src/steam/engine/feed-manifold.hpp index 4f69f3897..65dff69d4 100644 --- a/src/steam/engine/feed-manifold.hpp +++ b/src/steam/engine/feed-manifold.hpp @@ -256,7 +256,9 @@ namespace engine { using SigP = add_pointer_t::Sig>; template - using isSuitable = is_constructible>; + using isSuitable = __and_> + ,std::is_invocable + >; template using isConfigurable = __and_ @@ -605,8 +607,8 @@ namespace engine { template using Adapted = FeedPrototype; - template - using Decorated = FeedPrototype; + template + using Decorated = FeedPrototype; /** is the given functor suitable as parameter functor for this Feed? */ template @@ -632,12 +634,42 @@ namespace engine { return Adapted{move(procFun_), move(otherParamFun)}; } - template + template auto - moveDecoratedProc (DEC procFunDecorator) + moveDecoratedProc (FUX adaptedProcFun) { - using AugmentedProcFun = std::decay_t; - return Decorated{procFunDecorator (move(procFun_)), move(paramFun_)}; + using AugmentedProcFun = std::decay_t; + return Decorated{move(adaptedProcFun), move(paramFun_)}; + } + + template + auto + moveTransformedParam (TRA paramTransformer) + { + static_assert (_Trait::hasParam(), "Processing-functor with parameters expected"); + using SigP = lib::meta::_FunArg; + using SigI = typename _Proc::SigI; + using SigO = typename _Proc::SigO; + if constexpr (_Proc::hasInput()) + { + return moveDecoratedProc([procFun = move(procFun_) + ,transform = move(paramTransformer) + ] + (SigP par, SigI in, SigO out) + { + return procFun (transform(par), in, out); + }); + } + else + { + return moveDecoratedProc([procFun = move(procFun_) + ,transform = move(paramTransformer) + ] + (SigP par, SigO out) + { + return procFun (transform(par), out); + }); + } } diff --git a/src/steam/engine/weaving-pattern-builder.hpp b/src/steam/engine/weaving-pattern-builder.hpp index d43744d23..cb4e73c3f 100644 --- a/src/steam/engine/weaving-pattern-builder.hpp +++ b/src/steam/engine/weaving-pattern-builder.hpp @@ -296,7 +296,7 @@ namespace engine { using Adapted = WeavingBuilder>; template - using DecoratedPrototype = typename PROT::template Decorated; + using DecoratedPrototype = decltype(std::declval().moveTransformedParam (move (std::declval()))); /////OOO ugly!!!! template using Decorated = WeavingBuilder>; @@ -324,13 +324,12 @@ namespace engine { adaptProcFunParam (DEC decorator) { // static_assert (PROT::template isSuitable() -// ,"suitable as param-functor for given processing-functor"); //////////////////////////TODO +// ,"suitable as param-functor for given processing-functor"); //////////////////////////OOO need some static check here to reject processing-fun without params // using AdaptedWeavingBuilder = Decorated; // return AdaptedWeavingBuilder{move(*this) - ,prototype_.moveDecoratedProc (move (decorator)) - //////////////////////////////////////////////////////////////////////OOO need to do the actual adaptation here + ,prototype_.moveTransformedParam (move (decorator)) }; } diff --git a/tests/core/steam/engine/node-builder-test.cpp b/tests/core/steam/engine/node-builder-test.cpp index ee98a3384..483603bf5 100644 --- a/tests/core/steam/engine/node-builder-test.cpp +++ b/tests/core/steam/engine/node-builder-test.cpp @@ -176,15 +176,16 @@ namespace test { build_Node_adaptedParam() { auto procFun = [](ulong param, int* buff){ *buff = int(param); }; - auto adaptor = [](string const& spec){ return boost::lexical_cast(spec); }; + auto adaptor = [](string spec){ return boost::lexical_cast(spec); }; ProcNode node{prepareNode("Test") .preparePort() .invoke ("fun()", procFun) -// .adaptParam (adaptor) /////////////////////OOO engage here! -// .setParam ("55") + .adaptParam (adaptor) + .setParam ("55") .completePort() .build()}; +SHOW_EXPR(invokeRenderNode (node)); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index f770a383e..7687401d5 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -98072,8 +98072,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -105488,8 +105488,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) ...was auch immer das heißt — es gibt nämlich dafür noch kein Konzept; nur die Vorstellung, daß dafür irgendwo ein Schieberegler existiert

- - +
@@ -105509,8 +105508,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) demnach sollte auch die Param-Node zum Einsatz kommen

- - +
@@ -105557,6 +105555,22 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) + + + + + + + + + + + + + + + +