diff --git a/src/lib/iter-adapter.hpp b/src/lib/iter-adapter.hpp
index 2e491abd1..65178893d 100644
--- a/src/lib/iter-adapter.hpp
+++ b/src/lib/iter-adapter.hpp
@@ -266,7 +266,7 @@ namespace lib {
const ConRef source() const { return unConst(this)->source_; }
void
- resetPos (POS otherPos)
+ resetPos (POS otherPos) ////////////////////////////////////////////TICKET #1125 : get rid of this function! it should not be there; rectify IterSource!
{
pos_ = otherPos;
check();
diff --git a/src/lib/iter-source.hpp b/src/lib/iter-source.hpp
index 28429cd5d..402cadb7d 100644
--- a/src/lib/iter-source.hpp
+++ b/src/lib/iter-source.hpp
@@ -29,7 +29,11 @@
** a simple data source type, without needing to disclose details of
** the implementation.
**
- ** \par Standard Adapters
+ ** @todo the design used for the "iteration control API" is misaligned
+ ** with the purpose of this adapter. Rather, it should be shaped
+ ** similar to IterStateWrapper with three control functions //////////////////////////////////////TICKET #1125
+ **
+ ** ## Standard Adapters
** As a complement, this header contains a generic implementation
** of the IterSource interface by wrapping an existing Lumiera Forward Iterator.
** Using this WrappedLumieraIter, the details of this wrapped source iterator
@@ -89,7 +93,7 @@ namespace lib {
typedef TY* Pos;
typedef shared_ptr DataHandle;
-
+ ///////////////////////////////////////////////TICKET #1125 : this API should use three control functions, similar to IterStateWrapper
/** iteration start: prepare the first element.
* may return NULL in case of empty data source
*/
@@ -123,7 +127,7 @@ namespace lib {
/* == Iteration control API for IterAdapter frontend == */
- friend bool
+ friend bool ////////////////////////////////////////TICKET #1125 : this API should use three control functions, similar to IterStateWrapper
checkPoint (DataHandle const&, Pos const& pos)
{
return bool(pos);
@@ -141,7 +145,7 @@ namespace lib {
struct iterator
: IterAdapter
- {
+ { ////////////////////////////////////////////////////TICKET #1125 : should be build on top of IterStateWrapper rather than IterAdapter!
using _I = IterAdapter;
using _I::IterAdapter;
@@ -231,7 +235,7 @@ namespace lib {
IT src_;
- Pos
+ Pos ////////////////////////////////////////////////////TICKET #1125 : this API should use three control functions, similar to IterStateWrapper
firstResult ()
{
if (!src_)
diff --git a/src/lib/iter-tree-explorer.hpp b/src/lib/iter-tree-explorer.hpp
index 9ae370142..c3a2547db 100644
--- a/src/lib/iter-tree-explorer.hpp
+++ b/src/lib/iter-tree-explorer.hpp
@@ -737,6 +737,13 @@ namespace lib {
};
+ /**
+ * @todo expandChildren() should not return the value pointer.
+ * This is just a workaround to cope with the design mismatch in IterSource;
+ * the fact that latter just passes around a pointer into the implementation is
+ * ugly, dangerous and plain silly. ////////////////////////////////////////////////////////////TICKET #1125
+ * Incidentally, this is also the sole reason why this interface is templated with `VAL`
+ */
template
class ChildExpandableSource
{
@@ -755,7 +762,7 @@ namespace lib {
, public ChildExpandableSource
{
using Parent = WrappedLumieraIter;
- using Val = typename SRC::value_type;
+ using Val = typename SRC::value_type; ///////////////////////////////////TICKET #1125 : get rid of Val
public:
using Parent::Parent;
@@ -764,7 +771,7 @@ namespace lib {
expandChildren() override
{
Parent::wrappedIter().expandChildren();
- return Parent::wrappedIter()? & *Parent::wrappedIter()
+ return Parent::wrappedIter()? & *Parent::wrappedIter() ///////////////////////////////////TICKET #1125 : trickery to cope with the misaligned IterSource design
: nullptr;
}
};
@@ -798,7 +805,7 @@ namespace lib {
auto source = this->source().get();
VAL* changedResult = dynamic_cast (source)->expandChildren();
- this->resetPos (changedResult);
+ this->resetPos (changedResult); ///////////////////////////////////TICKET #1125 : trickery to cope with the misaligned IterSource design
}
diff --git a/tests/core/proc/play/diagnostic-output-slot.hpp b/tests/core/proc/play/diagnostic-output-slot.hpp
index 4837a9359..018d97150 100644
--- a/tests/core/proc/play/diagnostic-output-slot.hpp
+++ b/tests/core/proc/play/diagnostic-output-slot.hpp
@@ -372,15 +372,15 @@ namespace play {
uint currentFrame_;
- virtual Pos
- firstResult ()
+ virtual Pos //////////////////////////////////////////////TICKET #1125 : this API should use three control functions, similar to IterStateWrapper
+ firstResult () override
{
REQUIRE (0 == currentFrame_);
return outSeq_.accessEmittedFrame (currentFrame_);
}
virtual void
- nextResult (Pos& pos)
+ nextResult (Pos& pos) override
{
++currentFrame_;
pos = outSeq_.accessEmittedFrame(currentFrame_);
diff --git a/tests/library/iter-source-test.cpp b/tests/library/iter-source-test.cpp
index 16f8bc96f..07136d58d 100644
--- a/tests/library/iter-source-test.cpp
+++ b/tests/library/iter-source-test.cpp
@@ -90,8 +90,8 @@ namespace test{
string buffer_;
CStr current_;
- virtual Pos
- firstResult ()
+ virtual Pos ////////////////////////////////////////////TICKET #1125 : this iteration control API should use three control functions, similar to IterStateWrapper
+ firstResult () override
{
current_ = buffer_.c_str();
ENSURE (current_);
@@ -99,7 +99,7 @@ namespace test{
}
virtual void
- nextResult (Pos& pos)
+ nextResult (Pos& pos) override
{
if (pos && *pos && **pos)
++(*pos);
diff --git a/tests/library/iter-tree-explorer-test.cpp b/tests/library/iter-tree-explorer-test.cpp
index 984ee2192..e4f842012 100644
--- a/tests/library/iter-tree-explorer-test.cpp
+++ b/tests/library/iter-tree-explorer-test.cpp
@@ -728,30 +728,36 @@ namespace test{
void
verify_asIterSource()
{
- IterSource::iterator sequence;
+ IterSource::iterator sequence; // note `sequence` is polymorphic
CHECK (isnil (sequence));
sequence = treeExplore(CountDown{20,10})
.filter([](uint i){ return i % 2; })
- .asIterSource();
-
+ .asIterSource(); // note this terminal builder function
+ // moves the whole pipeline onto the heap
CHECK (not isnil (sequence));
CHECK (19 == *sequence);
+ // use one sequence as source to build another one
sequence = treeExplore(sequence)
.transform([](uint i){ return i*2; })
.asIterSource();
CHECK (38 == *sequence);
- cout << materialise (sequence) < exploreIter;
+ // extended API to invoke child expansion opaquely
+ IterExploreSource exploreIter;
CHECK (isnil (exploreIter));
exploreIter = treeExplore(CountDown{20,10})
@@ -759,20 +765,20 @@ namespace test{
.transform([](uint i){ return i*2; })
.filter([](int i){ return i>25; })
.expand([](uint i){ return CountDown{i-10, 20}; })
-// .transform([](uint u) -> char { return '@'+u-20; })
- .transform([](int u) -> uint { return u; })
+ .transform([](uint u) -> char { return '@'+u-20; })
.asIterSource();
-// CHECK (38 == *exploreIter);
+ CHECK ('R' == *exploreIter); // 38-20 + '@'
++exploreIter;
- exploreIter.expandChildren();
- cout << *exploreIter << endl;
- cout << materialise(exploreIter) << endl;
- cout << *exploreIter << endl;
-#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #888
-#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #888
- }
+ CHECK ('N' == *exploreIter); // 34-20 + '@'
+
+ exploreIter.expandChildren(); // expand consumes the current element (34)
+ // and injects the sequence (24...20[ instead
+ CHECK ('D' == *exploreIter); // 34-10 == 24 and 'D' == 24-20 + '@'
+
+ CHECK ("D-C-B-A-J-F" == materialise(exploreIter));
+ } // note how the remainder of the original sequence is picked up with 'J'...
/** @test use a preconfigured exploration scheme to expand depth-first until exhaustion
diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm
index cc59534a3..d4a222de9 100644
--- a/wiki/thinkPad.ichthyo.mm
+++ b/wiki/thinkPad.ichthyo.mm
@@ -5729,7 +5729,7 @@
-
+
@@ -5942,7 +5942,7 @@
-
+
@@ -5952,7 +5952,7 @@
Konzept funktioniert nicht
- iaus processing-Function
+ aus processing-Function
innen heraus
@@ -6015,6 +6015,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+ asIterSource() verwendet ein eigenes Interface, um diesen call an die Implementierung durchzureichen
+
+ -
+ in dieses Interface habe ich nun einen Rückgabewert eingebaut
+
+ -
+ damit kann ich das IterSource-Front-End refreshen
+
+ -
+ trotzdem hässlich...
+
+
+
+
+
+
+
@@ -6145,8 +6175,8 @@
-
-
+
+
@@ -6269,7 +6299,7 @@
-
+
@@ -6288,8 +6318,8 @@
-
-
+
+
@@ -6309,9 +6339,20 @@
-
+
+
+
+
+
+
+
+ Ticket machen: #1125
+
+
+
+
-
+
@@ -6655,12 +6696,12 @@
-
+
-
+
-
+