diff --git a/src/proc/engine/nodefactory.hpp b/src/proc/engine/nodefactory.hpp index 8dbcc5f0c..7abae3340 100644 --- a/src/proc/engine/nodefactory.hpp +++ b/src/proc/engine/nodefactory.hpp @@ -47,7 +47,7 @@ namespace engine { using std::vector; class Trafo; - typedef Trafo* PTrafo; ///< @todo handle ProcNode by pointer or by shared-ptr?? + typedef Trafo* PTrafo; ///< @note ProcNode is handled by pointer and bulk allocated/dealocated /** @@ -55,10 +55,6 @@ namespace engine { */ class NodeFactory { - /** custom deleter func allowing a smart-ptr - * to take ownership of processing nodes - */ - static void deleterFunc (ProcNode* pno) { delete pno; } public: diff --git a/src/proc/engine/nodeinvocation.hpp b/src/proc/engine/nodeinvocation.hpp index 2b5c0afbb..8b350d382 100644 --- a/src/proc/engine/nodeinvocation.hpp +++ b/src/proc/engine/nodeinvocation.hpp @@ -23,8 +23,8 @@ /** @file nodeinvocation.hpp ** Organize the state related to the invocation of s single ProcNode::pull() call ** This header defines part of the "glue" which holds together the render node network - ** and enables to pull a result frames from the nodes. Doing so requires some invocation - ** local state tobe maintained, especially a table of buffers used to carry out the + ** and enables to pull result frames from the nodes. Doing so requires some invocation + ** local state to be maintained, especially a table of buffers used to carry out the ** calculations. Further, getting the input buffers filled requires to issue recursive ** \c pull() calls, which on the whole creates a stack-like assembly of local invocation ** state. @@ -37,7 +37,7 @@ ** ** \par composition of the Invocation State ** For each individual ProcNode#pull() call, the WiringAdapter#callDown() builds an StateAdapter - ** instance directly on the stack, holding the actual buffer pointers and state references. Using this + ** instance directly on the stack, managing the actual buffer pointers and state references. Using this ** StateAdapter, the predecessor nodes are pulled. The way these operations are carried out is encoded ** in the actual StateAdapter type known to the NodeWiring (WiringAdapter) instance. All of these actual ** StateAdapter types are built as implementing the engine::State interface. @@ -196,7 +196,7 @@ namespace engine { { public: ActualInvocationProcess (State& callingProcess, WiringDescriptor const& w, const uint outCh) - : Invocation(callingProcess, w, outCh) + : BufferProvider(callingProcess, w, outCh) { } /** contains the details of Cache query and recursive calls diff --git a/src/proc/engine/nodeoperation.hpp b/src/proc/engine/nodeoperation.hpp index b413c15bb..b30c6cbeb 100644 --- a/src/proc/engine/nodeoperation.hpp +++ b/src/proc/engine/nodeoperation.hpp @@ -248,10 +248,10 @@ namespace engine { template struct SelectBuffProvider; - template<> struct SelectBuffProvider : AllocBufferFromCache { }; - template<> struct SelectBuffProvider : AllocBufferFromParent{ }; - template<> struct SelectBuffProvider : AllocBufferFromCache { }; - template<> struct SelectBuffProvider<> : AllocBufferFromParent{ }; + template<> struct SelectBuffProvider { typedef AllocBufferFromCache Type; }; + template<> struct SelectBuffProvider { typedef AllocBufferFromParent Type; }; + template<> struct SelectBuffProvider { typedef AllocBufferFromCache Type; }; + template<> struct SelectBuffProvider<> { typedef AllocBufferFromParent Type; }; template diff --git a/src/proc/engine/nodewiring.cpp b/src/proc/engine/nodewiring.cpp index dfbe534f9..6a20f86e4 100644 --- a/src/proc/engine/nodewiring.cpp +++ b/src/proc/engine/nodewiring.cpp @@ -30,15 +30,8 @@ namespace engine { - - namespace { // internal: setting up a factory for each required configuration - - using config::CACHING; - using config::PROCESS; - using config::INPLACE; - - using config::ConfigSelector; - using config::Strategy; + + namespace config { using lumiera::typelist::Flags; using lumiera::typelist::CombineFlags; @@ -49,16 +42,24 @@ namespace engine { typedef Flags::Tuple AllFlags; - + /** build the list of all possible flag combinations */ typedef CombineFlags AllFlagCombinations; - + /** build a configuration type for each of those flag combinations */ typedef Apply AllConfigs; /** filter those configurations which actually define a wiring strategy */ typedef Filter::Test> PossibleConfigs; + } // namespace config + + + + + namespace { // internal: setting up a factory for each required configuration + + using config::ConfigSelector; class Alloc {}; ///////////////TODO @@ -67,7 +68,7 @@ namespace engine { class WiringDescriptorFactory { Alloc& alloc_; - + public: WiringDescriptorFactory(Alloc& a) : alloc_(a) {} @@ -75,20 +76,32 @@ namespace engine { WiringDescriptor& operator() () { - /////////////////////////////////////////////TODO - //return offset_ + Maybe::CODE; + /////////////////////////////////////////////TODO + + typedef config::Strategy Strategy; + typedef typename config::SelectBuffProvider<>::Type BuffProvider; ////////////////////////TODO: how to extract the required flags from CONF?? + typedef ActualInvocationProcess InvocationStateType; + + typedef NodeWiring Product; + + Product * dummy (0); + return *dummy; } }; - typedef ConfigSelector WiringSelector; - + typedef ConfigSelector< WiringDescriptorFactory ///< Factory template + , WiringDescriptor& ///< type of the product + , Alloc& ///< allocator fed to all factories + > WiringSelector; + + struct WiringFactoryImpl { -// WiringSelector selector; + WiringSelector selector; WiringFactoryImpl (Alloc& alloc) -// : selector(PossibleConfigs::List(), alloc) + : selector(config::PossibleConfigs::List(), alloc) { } }; @@ -119,6 +132,6 @@ namespace engine { // return pImpl_->selector(config); } // BlockAlloc > > >::fabricate(); - + } // namespace engine diff --git a/src/proc/engine/nodewiring.hpp b/src/proc/engine/nodewiring.hpp index 2d1e587a4..442ca4297 100644 --- a/src/proc/engine/nodewiring.hpp +++ b/src/proc/engine/nodewiring.hpp @@ -44,8 +44,9 @@ namespace engine { * Actual implementation of the link between nodes, * also acting as "track switch" for the execution path * choosen while operating the node network for rendering. - * @param STATE StateAdapter object controlling the + * @param STATE Invocation state object controlling the * behaviour of callDown() while rendering. + * @see StateAdapter * @see NodeFactory */ template diff --git a/src/proc/engine/nodewiringconfig.hpp b/src/proc/engine/nodewiringconfig.hpp index c6df0c0db..0ebefd865 100644 --- a/src/proc/engine/nodewiringconfig.hpp +++ b/src/proc/engine/nodewiringconfig.hpp @@ -99,8 +99,8 @@ namespace engine { * heap allocated. */ template< template class Factory - , typename PAR ///< ctor parameter of the Factories - , typename RET ///< common base class of the Factory's products + , typename RET ///< common base class of the Factory's products + , typename PAR ///< ctor parameter of the Factories > class ConfigSelector { diff --git a/src/proc/engine/procnode.hpp b/src/proc/engine/procnode.hpp index 13d6e2241..343c6a6e8 100644 --- a/src/proc/engine/procnode.hpp +++ b/src/proc/engine/procnode.hpp @@ -133,13 +133,16 @@ namespace engine { static NodeFactory create; ///////TODO: really? probably we'll rather have a NodeFactory object in the builder... /** Engine Core operation: render and pull output from this node. - * On return, currentProcess will hold onto output buffer(s) - * containing the calculated result frames. + * On return, currentProcess will hold onto output buffer(s) + * containing the calculated result frames. In case this node + * calculates a multi channel output, only one channel can be + * retrieved by such a \c pull() call, but you can expect data + * of the other channels to be processed and fed to cache. * @param currentProcess the current processing state for * managing buffers and accessing current parameter values * @param requiredOutputNr the output channel requested (in case * this node delivers more than one output channel) - * @return ID of the result buffer (accessible via currentProcess) + * @return handle to the buffer containing the calculated result. */ BuffHandle pull (State& currentProcess, uint requiredOutputNr=0) const diff --git a/src/proc/mobject/builder/applicablebuildertargettypes.hpp b/src/proc/mobject/builder/applicablebuildertargettypes.hpp index e51fa1251..b02fb9d45 100644 --- a/src/proc/mobject/builder/applicablebuildertargettypes.hpp +++ b/src/proc/mobject/builder/applicablebuildertargettypes.hpp @@ -55,7 +55,7 @@ namespace mobject { * common selection of types to be handled by any such builder tool. * The actual BuilderTool impl should inherit from this template by * feeding back its type (CRTP), this causes a dispatcher table entry - * be generated for this concrete BuilderTool implementation. + * to be generated for this concrete BuilderTool implementation. */ template struct ApplicableBuilderTargetTypes diff --git a/src/proc/mobject/builder/operationpoint.hpp b/src/proc/mobject/builder/operationpoint.hpp index daa0f18d6..f72d9c711 100644 --- a/src/proc/mobject/builder/operationpoint.hpp +++ b/src/proc/mobject/builder/operationpoint.hpp @@ -54,7 +54,7 @@ namespace mobject { public: /** create node(s) corresponding to the given Processor-Asset * and wire them as a successor to this OperationPoint; then - * move this point to point at the resulting new exit node(s) + * move this point to refer to the resulting new exit node(s) */ void attach (asset::PProc const&); diff --git a/tests/50components.tests b/tests/50components.tests index 2bac409cb..9b15ca3ee 100644 --- a/tests/50components.tests +++ b/tests/50components.tests @@ -50,6 +50,109 @@ out: Standard Cmdlineformat:one two END +TEST "ConfigFlags_test" ConfigFlags_test <- +out: Conf2 :-<2>- +out: Conf3 :-<3>- +out: Conf4 :-<2>-<4>- +out: AllFlags :-<1>-<2>-<3>-<4>- +out: ______ +out: ______ check_flags() +out: Flags1 :-<2>-<4>- +out: Flags2 :-<2>-<4>- +out: SimpleConfig_defined_by_Typelist :-<1>- +out: AnotherConfig_defined_by_Typelist :-<1>-<2>-<3>-<4>- +out: ______ +out: ______ check_instantiation() +out: defined Conf0? ---> 0 +out: defined Conf1? ---> 1 +out: defined Conf2? ---> 1 +out: defined Conf3? ---> 1 +out: defined Conf4? ---> 1 +out: defined Trash? ---> 0 +out: ______ +out: ______ check_filter() +out: SomeFlagsets : +out: +---<1>-<3>-+ +out: +---<2>-<4>-+- +out: Configs_defined_by_Flagsets : +out: +-Conf-[-<1>-<3>-] +out: +-Conf-[-<2>-<4>-]- +out: Filter_possible_Configs : +out: +-Conf-[-<2>-<4>-]- +out: AllFlagCombinations : +out: +---<1>-<2>-<3>-<4>-<·>-+ +out: +---<1>-<2>-<3>-<·>-+ +out: +---<1>-<2>-<4>-<·>-+ +out: +---<1>-<2>-<·>-+ +out: +---<1>-<3>-<4>-<·>-+ +out: +---<1>-<3>-<·>-+ +out: +---<1>-<4>-<·>-+ +out: +---<1>-<·>-+ +out: +---<2>-<3>-<4>-<·>-+ +out: +---<2>-<3>-<·>-+ +out: +---<2>-<4>-<·>-+ +out: +---<2>-<·>-+ +out: +---<3>-<4>-<·>-+ +out: +---<3>-<·>-+ +out: +---<4>-<·>-+ +out: +---<·>-+- +out: ListAllConfigs : +out: +-Conf-[-<1>-<2>-<3>-<4>-] +out: +-Conf-[-<1>-<2>-<3>-] +out: +-Conf-[-<1>-<2>-<4>-] +out: +-Conf-[-<1>-<2>-] +out: +-Conf-[-<1>-<3>-<4>-] +out: +-Conf-[-<1>-<3>-] +out: +-Conf-[-<1>-<4>-] +out: +-Conf-[-<1>-] +out: +-Conf-[-<2>-<3>-<4>-] +out: +-Conf-[-<2>-<3>-] +out: +-Conf-[-<2>-<4>-] +out: +-Conf-[-<2>-] +out: +-Conf-[-<3>-<4>-] +out: +-Conf-[-<3>-] +out: +-Conf-[-<4>-] +out: +-Conf-[-]- +out: Filter_all_possible_Configs : +out: +-Conf-[-<1>-] +out: +-Conf-[-<2>-<3>-] +out: +-Conf-[-<2>-<4>-] +out: +-Conf-[-<2>-] +out: +-Conf-[-<3>-]- +out: ______ +out: ______ check_FlagInfo() +out: Flags1 :-<1>-<3>- +out: max bit : 3 +out: binary code: 10 +out: SomeConfigs : +out: +-Conf-[-<1>-<3>-] +out: +-Conf-[-<2>-<4>-]- +out: max bit in [SomeConfigs] : 4 +out: TestVisitor application: +out: visit(code=10) --> +out: +-Conf-[-<1>-<3>-]- +out: visit(code=20) --> +out: +-Conf-[-<2>-<4>-]- +out: ______ +out: ______ check_ConfigSelector() +out: Possible_Configs : +out: +-Conf-[-<1>-] +out: +-Conf-[-<2>-<3>-] +out: +-Conf-[-<2>-<4>-] +out: +-Conf-[-<2>-] +out: +-Conf-[-<3>-]- +out: Flag-code = 2 ConfigSelector() ---> 1010 +out: Flag-code = 12 ConfigSelector() ---> 1023 +out: Flag-code = 20 ConfigSelector() ---> 1024 +out: Flag-code = 4 ConfigSelector() ---> 1020 +out: Flag-code = 8 ConfigSelector() ---> 1030 +out: LUMIERA_ERROR_INVALID:invalid input or parameters (ConfigSelector: No preconfigured factory for config-bits=23). +return: 0 +END + + TEST "CustomSharedPtr_test" CustomSharedPtr_test < > out: ctor DoIt > out: ctor DoIt > @@ -241,6 +344,106 @@ return: 0 END +TEST "TypeListManipl_test" TypeListManipl_test <-<2>-<3>- +out: List2 :-<5>-<6>-<7>- +out: Added2 :-<3>-<4>-<5>- +out: Append1 :- +out: Append2 :-<11>-<22>- +out: Append3 :-<111>- +out: Append4 :-<222>- +out: Append5 :-<1>-<2>-<3>- +out: Append6 :-<5>-<6>-<7>- +out: Append7 :-<111>-<5>-<6>-<7>- +out: Append8 :-<1>-<2>-<3>-<222>- +out: Append9 :-<1>-<2>-<3>-<5>-<6>-<7>- +out: FilterEven :-<2>-<6>- +out: Prefix1 : +out: +---<11>-<22>-+- +out: Prefix2 : +out: +---<101>-<1>-+ +out: +---<101>-<2>-+ +out: +---<101>-<3>-+- +out: Prefix3 : +out: +---<1>-+ +out: +---<2>-+ +out: +---<3>-+- +out: Prefix4 : +out: +---<111>-<1>-<2>-<3>-+ +out: +---<111>-<0>-+ +out: +---<111>-<5>-<6>-<7>-+- +out: Prefix5 : +out: +---<1>-<2>-<3>-<5>-+ +out: +---<1>-<2>-<3>-<6>-+ +out: +---<1>-<2>-<3>-<7>-+- +out: Prefix6 : +out: +---<1>-<2>-<3>-<1>-<2>-<3>-+ +out: +---<1>-<2>-<3>-<0>-+ +out: +---<1>-<2>-<3>-<5>-<6>-<7>-+- +out: Dist1 : +out: +---<11>-<1>-+ +out: +---<11>-<2>-+ +out: +---<11>-<3>-+- +out: Dist2 : +out: +---<11>-<0>-+ +out: +---<22>-<0>-+ +out: +---<33>-<0>-+- +out: Dist3 : +out: +---<11>-<1>-+ +out: +---<11>-<2>-+ +out: +---<11>-<3>-+ +out: +---<22>-<1>-+ +out: +---<22>-<2>-+ +out: +---<22>-<3>-+ +out: +---<33>-<1>-+ +out: +---<33>-<2>-+ +out: +---<33>-<3>-+- +out: Dist4 : +out: +---<11>-<1>-<2>-<3>-+ +out: +---<11>-<5>-<6>-<7>-+ +out: +---<22>-<1>-<2>-<3>-+ +out: +---<22>-<5>-<6>-<7>-+ +out: +---<33>-<1>-<2>-<3>-+ +out: +---<33>-<5>-<6>-<7>-+- +out: Down :-<11>-<10>-<9>-<8>-<7>-<6>-<5>-<4>-<3>-<2>-<1>-<0>- +out: Combi : +out: +---<1>-<2>-<3>-<·>-+ +out: +---<1>-<2>-<2>-<·>-+ +out: +---<1>-<2>-<1>-<·>-+ +out: +---<1>-<2>-<0>-<·>-+ +out: +---<1>-<1>-<3>-<·>-+ +out: +---<1>-<1>-<2>-<·>-+ +out: +---<1>-<1>-<1>-<·>-+ +out: +---<1>-<1>-<0>-<·>-+ +out: +---<1>-<0>-<3>-<·>-+ +out: +---<1>-<0>-<2>-<·>-+ +out: +---<1>-<0>-<1>-<·>-+ +out: +---<1>-<0>-<0>-<·>-+ +out: +---<0>-<2>-<3>-<·>-+ +out: +---<0>-<2>-<2>-<·>-+ +out: +---<0>-<2>-<1>-<·>-+ +out: +---<0>-<2>-<0>-<·>-+ +out: +---<0>-<1>-<3>-<·>-+ +out: +---<0>-<1>-<2>-<·>-+ +out: +---<0>-<1>-<1>-<·>-+ +out: +---<0>-<1>-<0>-<·>-+ +out: +---<0>-<0>-<3>-<·>-+ +out: +---<0>-<0>-<2>-<·>-+ +out: +---<0>-<0>-<1>-<·>-+ +out: +---<0>-<0>-<0>-<·>-+- +out: OnOff : +out: +---<1>-<2>-<3>-<·>-+ +out: +---<1>-<2>-<·>-+ +out: +---<1>-<3>-<·>-+ +out: +---<1>-<·>-+ +out: +---<2>-<3>-<·>-+ +out: +---<2>-<·>-+ +out: +---<3>-<·>-+ +out: +---<·>-+- +return: 0 +END + + TEST "VisitingTool_test" VisitingTool_test < Flags1; typedef Flags Flags2; @@ -186,7 +186,8 @@ namespace lumiera { << "? ---> " \ << Instantiation::Test::value << "\n"; - cout << "\n==== check_instantiation()\n"; + DELIMITER (check_instantiation()); + CAN_INSTANTIATE (Conf0); CAN_INSTANTIATE (Conf1); CAN_INSTANTIATE (Conf2); @@ -203,7 +204,7 @@ namespace lumiera { */ void check_filter () { - cout << "\n==== check_filter()\n"; + DELIMITER (check_filter()); DISPLAY (SomeFlagsets); @@ -238,7 +239,7 @@ namespace lumiera { void visit (ulong code) { - result += str (format ("visit(code=%u) --> %s\n") + result += str (format ("visit(code=%u) -->%s\n") % code % Printer::print() ); } }; @@ -249,7 +250,7 @@ namespace lumiera { */ void check_FlagInfo() { - cout << "\n==== check_FlagInfo()\n"; + DELIMITER (check_FlagInfo()); DISPLAY (Flags1); cout << "max bit : " << FlagInfo::BITS <<"\n"; @@ -281,13 +282,16 @@ namespace lumiera { */ void check_ConfigSelector() { - cout << "\n==== check_ConfigSelector()\n"; + DELIMITER (check_ConfigSelector()); typedef Apply ListAllConfigs; typedef Filter::Test> Possible_Configs; DISPLAY (Possible_Configs); - typedef engine::config::ConfigSelector TestFactorySelector; + typedef engine::config::ConfigSelector< TestFactory // Factory template + , uint // product type + , long // common ctor argument + > TestFactorySelector; const long offset = 1000; // parameter fed to all TestFactory ctors TestFactorySelector testConfigSelector (Possible_Configs::List(), offset); diff --git a/tests/common/meta/typelistdiagnostics.hpp b/tests/common/meta/typelistdiagnostics.hpp index bccc05ab2..8de0e8d76 100644 --- a/tests/common/meta/typelistdiagnostics.hpp +++ b/tests/common/meta/typelistdiagnostics.hpp @@ -37,6 +37,7 @@ #include "common/meta/generator.hpp" + //#include "common/meta/typelistutil.hpp" //#include "common/meta/util.hpp" //#include "common/util.hpp" @@ -49,11 +50,33 @@ using boost::format; namespace lumiera { namespace typelist { + + /** constant-wrapper type for debugging purposes, + * usable for generating lists of distinguishable types + */ + template + struct Num + { + enum{ VAL=I }; + }; + + + /* some forwards used by configflagstest.cpp */ + template struct Flag; + template< char f1 + , char f2 + , char f3 + , char f4 + , char f5 + > + struct Config; + + + namespace test { - - namespace { // internal definitions + using boost::format; format fmt ("-<%u>%s"); @@ -75,8 +98,15 @@ namespace lumiera { static string print () { return str( fmt % "·" % BASE::print()); } }; + template + struct Printer, BASE> ///< display the presence of a Num instance in the typelist + : BASE + { + static string print () { return str( fmt % uint(Num::VAL) % BASE::print()); } + }; + template - struct Printer, BASE> + struct Printer, BASE> ///< display the presence of a Flag in the typelist : BASE { static string print () { return str( fmt % uint(Fl) % BASE::print()); } @@ -124,7 +154,7 @@ namespace lumiera { typedef InstantiateChained Contents_##LIST; #define DISPLAY(NAME) \ - DIAGNOSE(NAME); cout << STRINGIFY(NAME) << "\t" << Contents_##NAME::print() << "\n"; + DIAGNOSE(NAME); cout << STRINGIFY(NAME) << "\t:" << Contents_##NAME::print() << "\n"; diff --git a/tests/common/meta/typelistmaniptest.cpp b/tests/common/meta/typelistmaniptest.cpp index 9d2321299..f2b86c11e 100644 --- a/tests/common/meta/typelistmaniptest.cpp +++ b/tests/common/meta/typelistmaniptest.cpp @@ -41,6 +41,7 @@ #include "common/test/run.hpp" #include "common/meta/generator.hpp" #include "common/meta/typelistutil.hpp" +#include "meta/typelistdiagnostics.hpp" #include "common/util.hpp" #include @@ -56,65 +57,7 @@ namespace lumiera { namespace test { - namespace { // internal definitions - - boost::format fmt ("<%i>"); - - /** constant-wrapper type for debugging purposes, - * usable for generating lists of distinguishable types - */ - template - struct Num - { - enum{ VAL=I }; - static string str () { return boost::str (fmt % I); } - }; - - - /** debugging template, - * printing the "number" used for intantiation - */ - template - struct Printer; - - template - struct Printer - { - static string print () { return "-"; } - }; - - template - struct Printer, BASE> - : BASE - { - static string print () { return string("-") + Num::str() + BASE::print(); } - }; - - - typedef Printer NullP; - - /** call the debug-print for a typelist - * utilizing the Printer template */ - template - string - printSublist () - { - typedef InstantiateChained SubList; - return SubList::print(); - } - - /** Spezialisation for debug-printing of a nested sublist */ - template - struct Printer, BASE> - : BASE - { - static string print () - { - typedef Node List; - return string("\n\t+--") + printSublist()+"+" - + BASE::print(); - } - }; + namespace { // test data @@ -131,16 +74,10 @@ namespace lumiera { template struct CountDown { typedef NullType List; }; template<> struct CountDown > { typedef Node, NullType> List; }; template struct CountDown > { typedef Node, typename CountDown >::List> List; }; - -#define DIAGNOSE(LIST) \ - typedef InstantiateChained Contents_##LIST; - -#define DISPLAY(NAME) \ - DIAGNOSE(NAME); cout << STRINGIFY(NAME) << "\t" << Contents_##NAME::print() << "\n"; - } // (End) internal defs + } // (End) test data @@ -174,8 +111,8 @@ namespace lumiera { void check_diagnostics () { // Explanation: the DISPLAY macro expands as follows.... - typedef InstantiateChained > Contents_List1; - cout << "List1" << "\t" << Contents_List1::print() << "\n"; + typedef InstantiateChained Contents_List1; + cout << "List1" << "\t:" << Contents_List1::print() << "\n"; // That is: we instantiate the "Printer" template for each of the types in List1, // forming an inheritance chain. I.e. the defined Type "Contents_List1" inherits