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

#include "lib/iter-explorer.hpp"

Description

template<class SRC>
class lib::iter_explorer::Filter< SRC >

Decorator for IterExplorer to filter elements based on a predicate. Similar to the Transformer, the given functor is adapted as appropriate. However, we require the functor's result type to be convertible to bool, to serve as approval test. The filter predicate and thus the source iterator is evaluated eagerly, to establish the invariant of this class: if a "current element" exists, it has already been approved.

Definition at line 1114 of file iter-explorer.hpp.

Public Member Functions

 Filter ()=default
 
template<typename FUN >
 Filter (SRC &&dataSrc, FUN &&filterFun)
 
void expandChildren ()
 refresh state when other layers manipulate the source sequence.
 
bool checkPoint () const
 
SRC::reference yield () const
 
void iterNext ()
 

Protected Types

using FilterPredicate = function< bool(SRC &)>
 

Protected Member Functions

SRC & srcIter () const
 
bool isDisabled () const
 
void pullFilter ()
 

Protected Attributes

FilterPredicate predicate_
 

Constructor & Destructor Documentation

◆ Filter() [1/2]

template<class SRC >
Filter ( )
default

◆ Filter() [2/2]

template<class SRC >
template<typename FUN >
Filter ( SRC &&  dataSrc,
FUN &&  filterFun 
)
inline

Definition at line 1130 of file iter-explorer.hpp.

References Filter< SRC >::pullFilter().

+ Here is the call graph for this function:

Member Typedef Documentation

◆ FilterPredicate

template<class SRC >
using FilterPredicate = function<bool(SRC&)>
protected

Definition at line 1120 of file iter-explorer.hpp.

Member Function Documentation

◆ expandChildren()

template<class SRC >
void expandChildren ( )
inline

refresh state when other layers manipulate the source sequence.

Note
possibly pulls to re-establish the invariant

Definition at line 1141 of file iter-explorer.hpp.

References Filter< SRC >::pullFilter().

+ Here is the call graph for this function:

◆ checkPoint()

template<class SRC >
bool checkPoint ( ) const
inline

Definition at line 1150 of file iter-explorer.hpp.

References Filter< SRC >::srcIter().

+ Here is the call graph for this function:

◆ yield()

template<class SRC >
SRC::reference yield ( ) const
inline

Definition at line 1156 of file iter-explorer.hpp.

References Filter< SRC >::srcIter().

+ Here is the call graph for this function:

◆ iterNext()

template<class SRC >
void iterNext ( )
inline

Definition at line 1162 of file iter-explorer.hpp.

References Filter< SRC >::pullFilter(), and Filter< SRC >::srcIter().

+ Here is the call graph for this function:

◆ srcIter()

template<class SRC >
SRC & srcIter ( ) const
inlineprotected

Definition at line 1171 of file iter-explorer.hpp.

Referenced by Filter< SRC >::checkPoint(), Filter< SRC >::iterNext(), Filter< SRC >::pullFilter(), and Filter< SRC >::yield().

+ Here is the caller graph for this function:

◆ isDisabled()

template<class SRC >
bool isDisabled ( ) const
inlineprotected

Definition at line 1177 of file iter-explorer.hpp.

References Filter< SRC >::predicate_.

Referenced by Filter< SRC >::pullFilter().

+ Here is the caller graph for this function:

◆ pullFilter()

template<class SRC >
void pullFilter ( )
inlineprotected
Note
establishes the invariant: whatever the source yields as current element, has already been approved by our predicate

Definition at line 1186 of file iter-explorer.hpp.

References Filter< SRC >::isDisabled(), Filter< SRC >::predicate_, and Filter< SRC >::srcIter().

Referenced by Filter< SRC >::Filter(), Filter< SRC >::expandChildren(), and Filter< SRC >::iterNext().

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

Member Data Documentation

◆ predicate_

template<class SRC >
FilterPredicate predicate_
protected

Definition at line 1122 of file iter-explorer.hpp.

Referenced by Filter< SRC >::isDisabled(), and Filter< SRC >::pullFilter().

+ Inheritance diagram for Filter< SRC >:
+ Collaboration diagram for Filter< SRC >:

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