diff --git a/src/gui/interact/gen-node-location-query.hpp b/src/gui/interact/gen-node-location-query.hpp index 10545d309..07776798b 100644 --- a/src/gui/interact/gen-node-location-query.hpp +++ b/src/gui/interact/gen-node-location-query.hpp @@ -183,8 +183,8 @@ namespace interact { { return Symbol{id}; }; - return depth==UIC_PERSP? lib::singleVal (internedString (node.getType())) - : lib::transform (node.keys(), internedString); + return depth==UIC_PERSP? lib::iter_source::singleVal (internedString (node.getType())) + : lib::iter_source::transform (node.keys(), internedString); /////////////////////////////////////////////////////////////////////TICKET #1113 : could just use lib::wrapIter when GenNode exposes Literal as ID } diff --git a/src/include/play-facade.h b/src/include/play-facade.h index ecfc536a7..31894886b 100644 --- a/src/include/play-facade.h +++ b/src/include/play-facade.h @@ -36,7 +36,7 @@ //#include "include/interfaceproxy.hpp" #include "lib/handle.hpp" -#include "lib/iter-source.hpp" +#include "lib/iter-source.hpp" ////////////////////TICKET #493 : only using the IterSource base interface here #include "lib/time/control.hpp" #include "lib/time/timevalue.hpp" #include "include/interfaceproxy.hpp" diff --git a/src/lib/iter-source.hpp b/src/lib/iter-source.hpp index 13083d7e9..9a817e72a 100644 --- a/src/lib/iter-source.hpp +++ b/src/lib/iter-source.hpp @@ -142,9 +142,16 @@ namespace lib { struct iterator : IterAdapter { - using _I = IterAdapter - ; + using _I = IterAdapter; + using _I::IterAdapter; + iterator() =default; /////////////////////////////////////TICKET #1117 : why the hell do we need to declare all those ctor variants explicitly? I was under the impression ctor calls worked correct up to now without all this... + iterator(iterator&&) =default; + iterator(iterator const&) =default; + iterator(iterator& r) : iterator((iterator const&)r) { } + iterator& operator= (iterator &&) =default; + iterator& operator= (iterator const&) =default; + operator string() const {return _I::source()? string(*_I::source()) : "⟂"; } }; @@ -494,16 +501,7 @@ namespace lib { Range contents (begin, end); return IterSource::build (new WrappedLumieraIter(contents)); } - } - using iter_source::wrapIter; - using iter_source::singleVal; - using iter_source::transform; - using iter_source::eachMapKey; - using iter_source::eachDistinctKey; - using iter_source::eachValForKey; - using iter_source::eachMapVal; - using iter_source::eachEntry; - -} // namespace lib + +}} // namespace lib::iter_source #endif diff --git a/src/lib/iter-tree-explorer.hpp b/src/lib/iter-tree-explorer.hpp index 338f2e1cb..9d6d9e585 100644 --- a/src/lib/iter-tree-explorer.hpp +++ b/src/lib/iter-tree-explorer.hpp @@ -95,6 +95,7 @@ #include "lib/meta/trait.hpp" #include "lib/wrapper.hpp" ////////////TODO : could be more lightweight by splitting FunctionResult into separate header. Relevant? #include "lib/iter-adapter.hpp" +#include "lib/iter-source.hpp" /////////////TICKET #493 : only using the IterSource base feature / interface here. Should really split the iter-source.hpp #include "lib/iter-stack.hpp" #include "lib/util.hpp" #include "lib/test/test-helper.hpp"///////////TODO Bug-o @@ -452,6 +453,10 @@ namespace lib { : SRC { using SRC::SRC; + BaseAdapter(SRC const& src) : SRC(src) { } ////////////////////////TODO why the hell do we need to redeclare all those ctor variants???? + BaseAdapter(SRC && src) : SRC(src) { } + BaseAdapter(SRC & src) : SRC(src) { } + BaseAdapter() = default; void expandChildren() { } }; @@ -732,6 +737,25 @@ namespace lib { + /** + * @todo WIP 12/2017 + */ + template + struct IterExploreSource + : IterSource::iterator + { + + //////TODO clarify allowed ctors + + void + expandChildren() + { + UNIMPLEMENTED ("how to phone home..."); + } + + private: + }; + /** * Adapter to build a demand-driven tree expanding and exploring computation * based on a custom opaque _state core_. TreeExploer adheres to the _Monad_ @@ -757,6 +781,10 @@ namespace lib { /** pass-through ctor */ using SRC::SRC; + TreeExplorer(SRC const& src) : SRC(src) { } ////////////////////////TODO why the hell do we need to redeclare all those ctor variants???? why isn't copy initialisation propagated from the base ctors? + TreeExplorer(SRC && src) : SRC(src) { } + TreeExplorer(SRC & src) : SRC(src) { } + TreeExplorer() = default; @@ -842,6 +870,15 @@ namespace lib { } + /** @todo package as IterSource + */ + IterExploreSource + asIterSource() + { + UNIMPLEMENTED ("wrap into IterSource"); + } + + private: }; @@ -866,7 +903,7 @@ namespace lib { using SrcIter = typename _DecoratorTraits::SrcIter; using Base = iter_explorer::BaseAdapter; - return TreeExplorer {std::forward(srcSeq)}; + return TreeExplorer (std::forward (srcSeq)); } diff --git a/src/proc/engine/engine-service.cpp b/src/proc/engine/engine-service.cpp index 7269e541e..56a7e8362 100644 --- a/src/proc/engine/engine-service.cpp +++ b/src/proc/engine/engine-service.cpp @@ -43,7 +43,7 @@ namespace engine{ using std::function; using std::bind; using std::ref; - using lib::transform; + using lib::iter_source::transform; using lib::append_all; diff --git a/src/proc/mobject/session/placement-index.cpp b/src/proc/mobject/session/placement-index.cpp index 3556f2beb..2d971b6d2 100644 --- a/src/proc/mobject/session/placement-index.cpp +++ b/src/proc/mobject/session/placement-index.cpp @@ -79,6 +79,9 @@ namespace session { using lib::TypedAllocationManager; using lib::iter_stl::IterSnapshot; using lib::iter_stl::eachVal; + using lib::iter_source::eachMapKey; + using lib::iter_source::eachDistinctKey; + using lib::iter_source::eachValForKey; using std::placeholders::_1; using std::function; using std::bind; diff --git a/src/proc/mobject/session/scope.cpp b/src/proc/mobject/session/scope.cpp index 88ab80f71..8a8d13239 100644 --- a/src/proc/mobject/session/scope.cpp +++ b/src/proc/mobject/session/scope.cpp @@ -43,7 +43,7 @@ #include "proc/mobject/session/query-focus-stack.hpp" #include "proc/mobject/session/session-service-explore-scope.hpp" #include "proc/mobject/mobject.hpp" -#include "lib/iter-source.hpp" ////////////////////TICKET #493 : using the IterSource adapters here +#include "lib/iter-source.hpp" ////////////////////TICKET #493 : only using the IterSource wrapIter adapter here #include "common/query/query-resolver.hpp" #include diff --git a/src/proc/play/dummy-play-connection.hpp b/src/proc/play/dummy-play-connection.hpp index ff60ed45e..f67f6b4e2 100644 --- a/src/proc/play/dummy-play-connection.hpp +++ b/src/proc/play/dummy-play-connection.hpp @@ -131,7 +131,6 @@ namespace play { using lumiera::Query; // using lib::ScopedCollection; // using lib::Literal; - using lib::eachEntry; typedef asset::ID PID; typedef asset::ID TID; @@ -207,7 +206,7 @@ namespace play { ModelPorts getAllModelPorts() { - return eachEntry (modelPorts_.begin(), modelPorts_.end()); + return lib::iter_source::eachEntry (modelPorts_.begin(), modelPorts_.end()); } }; } diff --git a/src/proc/play/output-slot-connection.hpp b/src/proc/play/output-slot-connection.hpp index 33ddf3068..89db2b2d4 100644 --- a/src/proc/play/output-slot-connection.hpp +++ b/src/proc/play/output-slot-connection.hpp @@ -64,7 +64,6 @@ namespace play { //using proc::engine::BufferProvider; //using lib::time::Time; //using std::string; - using lib::transform; using lib::iter_stl::eachElm; //using std::placeholders::_1; @@ -177,7 +176,7 @@ namespace play { { //////////////////////////TICKET #878 not re-entrant, lifecycle isn't clear REQUIRE (this->isActive()); - return transform (eachElm(connections_), connectOutputSink); + return lib::iter_source::transform (eachElm(connections_), connectOutputSink); } Timings diff --git a/src/proc/play/play-process.cpp b/src/proc/play/play-process.cpp index 4317e4ddc..2b3fe88e7 100644 --- a/src/proc/play/play-process.cpp +++ b/src/proc/play/play-process.cpp @@ -35,6 +35,8 @@ //#include //#include +using lib::iter_source::transform; +using lib::append_all; namespace proc { @@ -43,8 +45,6 @@ namespace play { // using std::string; // using lumiera::Subsys; // using std::bind; - using lib::transform; - using lib::append_all; namespace { // Implementation details... diff --git a/src/proc/play/play-process.hpp b/src/proc/play/play-process.hpp index 7fb265303..3b195012a 100644 --- a/src/proc/play/play-process.hpp +++ b/src/proc/play/play-process.hpp @@ -58,7 +58,7 @@ //#include "lib/singleton-ref.hpp" #include "proc/mobject/model-port.hpp" #include "proc/engine/calc-stream.hpp" -#include "lib/iter-source.hpp" +#include "lib/iter-source.hpp" ////////////////////TICKET #493 : only using the IterSource base feature here #include "lib/util.hpp" // #include diff --git a/tests/library/iter-source-test.cpp b/tests/library/iter-source-test.cpp index daeb09150..16f8bc96f 100644 --- a/tests/library/iter-source-test.cpp +++ b/tests/library/iter-source-test.cpp @@ -61,6 +61,14 @@ namespace test{ using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST; + using iter_source::eachEntry; + using iter_source::transform; + using iter_source::singleVal; + using iter_source::eachMapKey; + using iter_source::eachMapVal; + using iter_source::eachValForKey; + using iter_source::eachDistinctKey; + namespace { // Subject of test diff --git a/tests/library/iter-tree-explorer-test.cpp b/tests/library/iter-tree-explorer-test.cpp index c684a6da1..70047c815 100644 --- a/tests/library/iter-tree-explorer-test.cpp +++ b/tests/library/iter-tree-explorer-test.cpp @@ -723,12 +723,42 @@ namespace test{ /** @test package the resulting Iterator as automatically managed, - * polymorphic opaque implementing the IterSource interface. + * polymorphic opaque entity implementing the IterSource interface. */ void verify_asIterSource() { - UNIMPLEMENTED("package as IterSource"); + IterSource::iterator sequence; + CHECK (isnil (sequence)); + + sequence = treeExplore(CountDown{20,10}) + .filter([](uint i){ return i % 2; }) + .asIterSource(); + + CHECK (not isnil (sequence)); + CHECK (19 == *sequence); + + cout << materialise (sequence) < exploreIter; + CHECK (isnil (exploreIter)); + + exploreIter = treeExplore(sequence) + .filter([](int i){ return i>30; }) + .expand([](int i){ return CountDown{i-10, 20}; }) + .transform([](uint u) -> char { return '@'+u-20; }) + .asIterSource(); + + CHECK (38 == *sequence); + cout << materialise(exploreIter) << endl; + + CHECK (isnil (sequence)); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 04a8d9cd8..1bc8dfbcf 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -5691,7 +5691,7 @@ - + @@ -6018,12 +6018,39 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6329,9 +6356,67 @@ - + + + + + + + + + + + + +

+ verschiedendste Pipeline-Konstruktionen +

+

+ können nun hinter dem gleichen Interface sitzen +

+ + +
+ +
+ + + + + + + + + +

+ rein ein Problem mit der Test-Fixture. +

+

+ Da die Quelle nun von einem shared-ptr gehalten wird, +

+

+ erzeugt eine Kopie des Iterator-Front-End +

+

+ nun nicht mehr eine Kopie des ganzen Zustandes. +

+

+ +

+

+ das wäre aber bequem für den Test. +

+

+ Frage: ist das überhaupt eine gute Idee, vom Design her?? +

+ + +
+ +
+