Navigator: build iterator front-end based on the new TreeExploer capabilities
...but not yet switched into the main LocationQuery interface, because that would also break the existing implementation; recasting this implementation is the next step to do....
This commit is contained in:
parent
d653937465
commit
2ea2d38cb2
4 changed files with 66 additions and 26 deletions
|
|
@ -101,13 +101,28 @@ namespace interact {
|
|||
virtual TreeStructureNavigator* expandChildren() const =0;
|
||||
|
||||
|
||||
/** build a Lumiera Forward Iterator as front-end for `*this`.
|
||||
* @return copyable iterator front-end handle, which allows to retrieve once all values
|
||||
* yielded by this IterSource. The front-end does _not take ownership_ of this object.
|
||||
* @note the generated iterator is preconfigured to allow for _"child expansion"_, thereby
|
||||
* calling through the virtual API function expandChildren()
|
||||
*/
|
||||
auto
|
||||
buildIterator ()
|
||||
{
|
||||
return lib::treeExplore (*this)
|
||||
.expand([](TreeStructureNavigator& parent){ return parent.expandChildren(); });
|
||||
}
|
||||
|
||||
/** build a Lumiera Forward Iterator as front-end and managing Handle for a heap allocated
|
||||
* TreeStructureNavigator or subclass. The provided pointer is assumed to point to heap allocated
|
||||
* storage, which will be owned by the generated iterator.
|
||||
*/
|
||||
static auto
|
||||
buildIterator (TreeStructureNavigator* source)
|
||||
{
|
||||
return lib::treeExplore(
|
||||
lib::IterSource<Literal>::build (source))
|
||||
.expand([](Literal id){ return lib::IterSource<Literal>::build (
|
||||
((TreeStructureNavigator*)nullptr)->expandChildren() ); });
|
||||
return lib::treeExplore (source)
|
||||
.expand([](TreeStructureNavigator& parent){ return parent.expandChildren(); });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -290,18 +290,21 @@ namespace lib {
|
|||
class IterSourceIter
|
||||
: public ISO::iterator
|
||||
{
|
||||
using Iterator = typename ISO::iterator;
|
||||
|
||||
public:
|
||||
IterSourceIter() =default;
|
||||
// standard copy operations
|
||||
|
||||
/** link to existing IterSource (without memory management) */
|
||||
IterSourceIter (ISO& externalSource)
|
||||
: ISO::iterator{ISO::build (externalSource)}
|
||||
: Iterator{ISO::build (externalSource)}
|
||||
{ }
|
||||
|
||||
/** own and manage a heap allocated IterSource */
|
||||
IterSourceIter (ISO* heap_allocated_IterSource)
|
||||
: ISO::iterator{ISO::build (heap_allocated_IterSource)}
|
||||
IterSourceIter (ISO* heapObject)
|
||||
: Iterator{heapObject? ISO::build (heapObject)
|
||||
: Iterator()}
|
||||
{ }
|
||||
|
||||
using Source = ISO;
|
||||
|
|
@ -417,12 +420,15 @@ namespace lib {
|
|||
using SrcVal = typename ISO::value_type;
|
||||
};
|
||||
|
||||
template<class ISO>
|
||||
struct _DecoratorTraits<ISO*&, enable_if<is_base_of<IterSource<typename ISO::value_type>, ISO>>>
|
||||
: _DecoratorTraits<ISO*>
|
||||
{ };
|
||||
|
||||
template<class ISO>
|
||||
struct _DecoratorTraits<ISO&, enable_if<is_base_of<IterSource<typename ISO::value_type>, ISO>>>
|
||||
{
|
||||
using SrcIter = iter_explorer::IterSourceIter<ISO>;
|
||||
using SrcVal = typename ISO::value_type;
|
||||
};
|
||||
: _DecoratorTraits<ISO*>
|
||||
{ };
|
||||
|
||||
}//(End) TreeExplorer traits
|
||||
|
||||
|
|
|
|||
|
|
@ -900,6 +900,10 @@ namespace test{
|
|||
treeExplore(new VerySpecivicIter{7})));
|
||||
|
||||
|
||||
// missing source detected
|
||||
PrivateSource* niente = nullptr;
|
||||
CHECK (isnil (treeExplore(niente)));
|
||||
|
||||
|
||||
// attach to an IterSource living here in local scope...
|
||||
VerySpecivicIter vsit{5};
|
||||
|
|
@ -918,7 +922,7 @@ namespace test{
|
|||
CHECK (4 == vsit.currentVal());
|
||||
|
||||
CHECK (0 == ii.depth());
|
||||
ii.expandChildren(); // note: calls through source's VTable to invoke VerySpecificIter::expandChildren()
|
||||
ii.expandChildren(); // note: calls through source's VTable to invoke VerySpecificIter::expandChildren()
|
||||
CHECK (1 == ii.depth());
|
||||
|
||||
CHECK (2 == *ii);
|
||||
|
|
|
|||
|
|
@ -977,7 +977,7 @@
|
|||
<node CREATED="1502454601603" ID="ID_384770680" MODIFIED="1502454613220" TEXT="nein: MutationMessage wird überflüssig">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1502401987033" ID="ID_1584846573" MODIFIED="1513962913100" TEXT="erfordert Festlegung der Natur der Diff Message">
|
||||
<node CREATED="1502401987033" ID="ID_1584846573" MODIFIED="1514086999279" TEXT="erfordert Festlegung der Natur der Diff Message">
|
||||
<arrowlink COLOR="#bdbad3" DESTINATION="ID_89098030" ENDARROW="Default" ENDINCLINATION="821;-1406;" ID="Arrow_ID_554743885" STARTARROW="None" STARTINCLINATION="1459;870;"/>
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1502402004383" ID="ID_1491065212" MODIFIED="1502403195803" TEXT="generisch bleiben?">
|
||||
|
|
@ -7603,7 +7603,7 @@
|
|||
<arrowlink COLOR="#585e9d" DESTINATION="ID_845080696" ENDARROW="Default" ENDINCLINATION="-101;761;" ID="Arrow_ID_402051988" STARTARROW="None" STARTINCLINATION="208;5;"/>
|
||||
</node>
|
||||
<node CREATED="1510941661615" ID="ID_463290050" MODIFIED="1510941665179" TEXT="verpackt in IterSource"/>
|
||||
<node COLOR="#338800" CREATED="1513561602173" HGAP="180" ID="ID_760843174" MODIFIED="1513978303329" TEXT="Design" VSHIFT="29">
|
||||
<node COLOR="#338800" CREATED="1513561602173" FOLDED="true" HGAP="180" ID="ID_760843174" MODIFIED="1514087033060" TEXT="Design" VSHIFT="29">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1513560607636" ID="ID_774099115" MODIFIED="1513561433218" TEXT="expand -- wie?">
|
||||
<icon BUILTIN="help"/>
|
||||
|
|
@ -7612,7 +7612,8 @@
|
|||
<node CREATED="1513560646014" ID="ID_812625308" MODIFIED="1513560649570" TEXT="implementation defined"/>
|
||||
<node CREATED="1513560650614" ID="ID_127083955" MODIFIED="1513560657793" TEXT="muß dort Kind-iterieren können"/>
|
||||
</node>
|
||||
<node CREATED="1513561422541" ID="ID_1500554436" MODIFIED="1513961543467" TEXT="was ist depth()?">
|
||||
<node CREATED="1513561422541" ID="ID_1500554436" MODIFIED="1514087030296" TEXT="was ist depth()?">
|
||||
<arrowlink COLOR="#62326e" DESTINATION="ID_1709677569" ENDARROW="Default" ENDINCLINATION="-209;-29;" ID="Arrow_ID_894748806" STARTARROW="Default" STARTINCLINATION="43;132;"/>
|
||||
<linktarget COLOR="#9493b7" DESTINATION="ID_1500554436" ENDARROW="Default" ENDINCLINATION="91;103;" ID="Arrow_ID_811314610" SOURCE="ID_937539446" STARTARROW="None" STARTINCLINATION="-39;0;"/>
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1513561437011" ID="ID_263179318" MODIFIED="1513561443415" TEXT="absolut oder relativ"/>
|
||||
|
|
@ -7940,6 +7941,20 @@
|
|||
</node>
|
||||
<node CREATED="1513961683154" ID="ID_1803800382" MODIFIED="1513961693725" TEXT="Expander kommt vor das IterSource-Interface"/>
|
||||
<node CREATED="1513962370870" ID="ID_1858133966" MODIFIED="1513962394590" TEXT="in einen komplett generischen Iterator-Typ"/>
|
||||
<node CREATED="1514086892237" ID="ID_1709677569" MODIFIED="1514087030296" TEXT="depth() bleibt vorerst relativ">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...mal sehen, ob wir jemals daran anstoßen...
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<linktarget COLOR="#62326e" DESTINATION="ID_1709677569" ENDARROW="Default" ENDINCLINATION="-209;-29;" ID="Arrow_ID_894748806" SOURCE="ID_1500554436" STARTARROW="Default" STARTINCLINATION="43;132;"/>
|
||||
</node>
|
||||
<node CREATED="1513961696753" ID="ID_1159003711" MODIFIED="1513961771032" TEXT="unschön aber zukunftsweisend...">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
<node CREATED="1513961791716" FOLDED="true" ID="ID_996099359" MODIFIED="1513978359858" TEXT="zusätzliche Heap-Alloc für jedes Expand">
|
||||
|
|
@ -7999,9 +8014,9 @@
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1513961620603" ID="ID_1014293898" MODIFIED="1513961632617" TEXT="Implementierung">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1513962702097" ID="ID_1829231358" MODIFIED="1513985168996" TEXT="Iterator-Typ konstruieren">
|
||||
<node COLOR="#338800" CREATED="1513962702097" ID="ID_1829231358" MODIFIED="1514086559864" TEXT="Iterator-Typ konstruieren">
|
||||
<arrowlink COLOR="#1d3877" DESTINATION="ID_989478065" ENDARROW="Default" ENDINCLINATION="33;-151;" ID="Arrow_ID_1500458185" STARTARROW="Default" STARTINCLINATION="-102;2;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1513966648491" ID="ID_558045889" MODIFIED="1513966652550" TEXT="Anforderungen">
|
||||
<node CREATED="1513962999465" ID="ID_677650141" MODIFIED="1513963008827" TEXT="ist nicht mehr IterSource<String>::iterator"/>
|
||||
<node CREATED="1513963010239" ID="ID_1755646553" MODIFIED="1513963023753" TEXT="baut auf einem Sub-Interface von IterSource auf"/>
|
||||
|
|
@ -8009,7 +8024,7 @@
|
|||
<node CREATED="1513963055921" ID="ID_598702105" MODIFIED="1513963075090" TEXT="exponiert das expandChildren()"/>
|
||||
</node>
|
||||
<node CREATED="1513966658753" ID="ID_1038653404" MODIFIED="1513966664964" TEXT="Konstrukt">
|
||||
<node CREATED="1513966673608" ID="ID_343053579" MODIFIED="1513966861900" TEXT="auf IterExploreSource aufbauen?">
|
||||
<node CREATED="1513966673608" FOLDED="true" ID="ID_343053579" MODIFIED="1514086565906" TEXT="auf IterExploreSource aufbauen?">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1513966727648" ID="ID_538128057" MODIFIED="1513966744402" TEXT="das Interface wird in der Implementierung druchgreicht"/>
|
||||
<node CREATED="1513966745134" ID="ID_1575558282" MODIFIED="1513966751273" TEXT="man kommt da nicht ohne weiteres ran"/>
|
||||
|
|
@ -8021,7 +8036,7 @@
|
|||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1513966690757" ID="ID_335317868" MODIFIED="1513966865080" TEXT="direkt IterSource::iterator reimplementieren">
|
||||
<node CREATED="1513966690757" FOLDED="true" ID="ID_335317868" MODIFIED="1514086567369" TEXT="direkt IterSource::iterator reimplementieren">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1513966814204" ID="ID_1477637829" MODIFIED="1513966818232" TEXT="ist halt lästig"/>
|
||||
<node CREATED="1513966819268" ID="ID_725108588" MODIFIED="1513966823134" TEXT="hier aber wohl einfacher"/>
|
||||
|
|
@ -8062,7 +8077,7 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1513981063250" ID="ID_1701586789" MODIFIED="1513985115106" TEXT="Builder">
|
||||
<node CREATED="1513981063250" HGAP="29" ID="ID_1701586789" MODIFIED="1514086578389" TEXT="Builder" VSHIFT="7">
|
||||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1513981080616" ID="ID_75384138" MODIFIED="1513981107456" TEXT="bekommt TreeStructureNavigator *"/>
|
||||
<node CREATED="1513981138280" ID="ID_878429069" MODIFIED="1513981146075" TEXT="baut darauf den IterSource::iterator"/>
|
||||
|
|
@ -8084,7 +8099,7 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1513962712192" ID="ID_357363842" MODIFIED="1513992370526" TEXT="festlegen, wo die VTable ist">
|
||||
<node COLOR="#338800" CREATED="1513962712192" FOLDED="true" ID="ID_357363842" MODIFIED="1514086581208" TEXT="festlegen, wo die VTable ist">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1513978430367" ID="ID_616991569" MODIFIED="1513978446605" TEXT="Nav und Iter">
|
||||
<icon BUILTIN="yes"/>
|
||||
|
|
@ -8093,8 +8108,8 @@
|
|||
<icon BUILTIN="info"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1513986023498" ID="ID_1413967372" MODIFIED="1513992377089" TEXT="Integration mit TreeExplorer">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1513986023498" ID="ID_1413967372" MODIFIED="1514086552947" TEXT="Integration mit TreeExplorer">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1513986032290" ID="ID_1427647343" MODIFIED="1513986048710" TEXT="Problem: Zugang zur IterSource">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1513986054199" ID="ID_1239076586" MODIFIED="1513986063345" TEXT="bisher: protected im IterSource::iterator"/>
|
||||
|
|
@ -8121,9 +8136,9 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1513988744665" HGAP="27" ID="ID_1242119956" MODIFIED="1513992382452" TEXT="vorläufige IterSource-Integration" VSHIFT="12">
|
||||
<node COLOR="#338800" CREATED="1513988744665" HGAP="27" ID="ID_1242119956" MODIFIED="1514086542637" TEXT="vorläufige IterSource-Integration" VSHIFT="12">
|
||||
<linktarget COLOR="#1f9aa8" DESTINATION="ID_1242119956" ENDARROW="Default" ENDINCLINATION="87;-111;" ID="Arrow_ID_662359263" SOURCE="ID_1398933111" STARTARROW="None" STARTINCLINATION="-259;16;"/>
|
||||
<icon BUILTIN="pencil"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1513988930537" ID="ID_594152265" MODIFIED="1513992353318" TEXT="kann selbständig Iterator-Front-End bauen">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
|
|
@ -17000,7 +17015,7 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1502453753155" ID="ID_89098030" MODIFIED="1513962913100" TEXT="Schritt-2">
|
||||
<node CREATED="1502453753155" ID="ID_89098030" MODIFIED="1514086999279" TEXT="Schritt-2">
|
||||
<linktarget COLOR="#bdbad3" DESTINATION="ID_89098030" ENDARROW="Default" ENDINCLINATION="821;-1406;" ID="Arrow_ID_554743885" SOURCE="ID_1584846573" STARTARROW="None" STARTINCLINATION="1459;870;"/>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1502453814499" ID="ID_727706359" MODIFIED="1502453827917" TEXT="Puffer-Ansatz...">
|
||||
|
|
|
|||
Loading…
Reference in a new issue