Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
ExtensibleFilterIter< IT > Class Template Reference

#include "lib/itertools.hpp"

Description

template<class IT>
class lib::ExtensibleFilterIter< IT >

Additional capabilities for FilterIter, allowing to extend the filter condition underway.

This wrapper enables remoulding of the filer functor while in the middle of iteration. When the filter is modified, current head of iteration gets re-evaluated and possible fast-forwarded to the next element satisfying the now extended filter condition.

Note
changing the condition modifies a given iterator in place. Superficially this might look as if the storage remains the same, but in fact we're adding a lambda closure, which the runtime usually allocates on the heap, holding the previous functor and a second functor for the added clause.
Warning
the addition of disjunctive and negated clauses might actually weaken the filter condition. Yet still there is no reset of the source iterator, i.e. we don't re-evaluate from start, but just from current head. Which means we might miss elements in the already consumed part of the source sequence, which theoretically would pass the now altered filter condition.
See also
IterTools_test::verify_filterExtension

Definition at line 410 of file itertools.hpp.

Public Member Functions

 ExtensibleFilterIter ()
 
template<typename PRED >
 ExtensibleFilterIter (IT &&src, PRED initialFilterPredicate)
 
template<typename PRED >
 ExtensibleFilterIter (IT const &src, PRED initialFilterPredicate)
 
 ExtensibleFilterIter (IT &&src)
 
IT & underlying ()
 access the unfiltered source iterator in current state
 
template<typename COND >
ExtensibleFilterIterandFilter (COND conjunctiveClause)
 
template<typename COND >
ExtensibleFilterIterandNotFilter (COND conjunctiveClause)
 
template<typename COND >
ExtensibleFilterIterorFilter (COND disjunctiveClause)
 
template<typename COND >
ExtensibleFilterIterorNotFilter (COND disjunctiveClause)
 
template<typename COND >
ExtensibleFilterItersetNewFilter (COND entirelyDifferentPredicate)
 
ExtensibleFilterIterflipFilter ()
 
- Public Member Functions inherited from FilterIter< IT >
 FilterIter ()
 
template<typename PRED >
 FilterIter (IT const &src, PRED filterPredicate)
 
template<typename PRED >
 FilterIter (IT &&src, PRED filterPredicate)
 
- Public Member Functions inherited from IterTool< FilterCore< IT > >
 IterTool (FilterCore< IT > &&setup)
 
 operator bool () const
 
reference operator* () const
 
pointer operator-> () const
 
IterTooloperator++ ()
 
bool isValid () const
 
bool empty () const
 

Private Types

using _Filter = FilterCore< IT >
 
using Val = _Filter::Val
 

Private Member Functions

void reEvaluate ()
 

Additional Inherited Members

- Public Types inherited from IterTool< FilterCore< IT > >
using pointer = CORE::pointer
 
using reference = CORE::reference
 
using value_type = CORE::value_type
 
- Static Public Member Functions inherited from FilterIter< IT >
static bool acceptAll (_Filter::Val)
 
- Protected Member Functions inherited from IterTool< FilterCore< IT > >
bool hasData () const
 
bool iterate ()
 
void _maybe_throw () const
 
- Protected Attributes inherited from IterTool< FilterCore< IT > >
FilterCore< IT > core_
 

Constructor & Destructor Documentation

◆ ExtensibleFilterIter() [1/4]

template<class IT >
ExtensibleFilterIter ( )
inline

Definition at line 424 of file itertools.hpp.

◆ ExtensibleFilterIter() [2/4]

template<class IT >
template<typename PRED >
ExtensibleFilterIter ( IT &&  src,
PRED  initialFilterPredicate 
)
inline

Definition at line 427 of file itertools.hpp.

◆ ExtensibleFilterIter() [3/4]

template<class IT >
template<typename PRED >
ExtensibleFilterIter ( IT const &  src,
PRED  initialFilterPredicate 
)
inline

Definition at line 431 of file itertools.hpp.

◆ ExtensibleFilterIter() [4/4]

template<class IT >
ExtensibleFilterIter ( IT &&  src)
inline

Definition at line 435 of file itertools.hpp.

Member Typedef Documentation

◆ _Filter

template<class IT >
using _Filter = FilterCore<IT>
private

Definition at line 413 of file itertools.hpp.

◆ Val

template<class IT >
using Val = _Filter::Val
private

Definition at line 414 of file itertools.hpp.

Member Function Documentation

◆ reEvaluate()

template<class IT >
void reEvaluate ( )
inlineprivate

Definition at line 417 of file itertools.hpp.

References IterTool< FilterCore< IT > >::core_, and IterTool< FilterCore< IT > >::hasData().

Referenced by ExtensibleFilterIter< IT >::andFilter(), ExtensibleFilterIter< IT >::andNotFilter(), ExtensibleFilterIter< IT >::flipFilter(), ExtensibleFilterIter< IT >::orFilter(), ExtensibleFilterIter< IT >::orNotFilter(), and ExtensibleFilterIter< IT >::setNewFilter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ underlying()

template<class IT >
IT & underlying ( )
inline

access the unfiltered source iterator in current state

Definition at line 445 of file itertools.hpp.

References IterTool< FilterCore< IT > >::core_.

◆ andFilter()

template<class IT >
template<typename COND >
ExtensibleFilterIter & andFilter ( COND  conjunctiveClause)
inline

Definition at line 453 of file itertools.hpp.

References IterTool< FilterCore< IT > >::core_, and ExtensibleFilterIter< IT >::reEvaluate().

+ Here is the call graph for this function:

◆ andNotFilter()

template<class IT >
template<typename COND >
ExtensibleFilterIter & andNotFilter ( COND  conjunctiveClause)
inline

Definition at line 468 of file itertools.hpp.

References IterTool< FilterCore< IT > >::core_, and ExtensibleFilterIter< IT >::reEvaluate().

+ Here is the call graph for this function:

◆ orFilter()

template<class IT >
template<typename COND >
ExtensibleFilterIter & orFilter ( COND  disjunctiveClause)
inline

Definition at line 483 of file itertools.hpp.

References IterTool< FilterCore< IT > >::core_, and ExtensibleFilterIter< IT >::reEvaluate().

+ Here is the call graph for this function:

◆ orNotFilter()

template<class IT >
template<typename COND >
ExtensibleFilterIter & orNotFilter ( COND  disjunctiveClause)
inline

Definition at line 498 of file itertools.hpp.

References IterTool< FilterCore< IT > >::core_, and ExtensibleFilterIter< IT >::reEvaluate().

+ Here is the call graph for this function:

◆ setNewFilter()

template<class IT >
template<typename COND >
ExtensibleFilterIter & setNewFilter ( COND  entirelyDifferentPredicate)
inline

Definition at line 514 of file itertools.hpp.

References IterTool< FilterCore< IT > >::core_, and ExtensibleFilterIter< IT >::reEvaluate().

+ Here is the call graph for this function:

◆ flipFilter()

template<class IT >
ExtensibleFilterIter & flipFilter ( )
inline

Definition at line 522 of file itertools.hpp.

References IterTool< FilterCore< IT > >::core_, and ExtensibleFilterIter< IT >::reEvaluate().

+ Here is the call graph for this function:
+ Inheritance diagram for ExtensibleFilterIter< IT >:
+ Collaboration diagram for ExtensibleFilterIter< IT >:

The documentation for this class was generated from the following file: