![]() |
Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/iter-explorer.hpp"
Special variant of the Filter Decorator to allow for dynamic remoulding. This covers a rather specific use case, where we want to remould or even exchange the Filter predicate in the middle of an ongoing iteration. Such a remoulding can be achieved by binding the existing (opaque) filter predicate into a new combined lambda, thereby capturing it by value. After building, this remoulded version can be assigned to the original filter functor, under the assumption that both are roughly compatible. Moreover, since we wrap the actual lambda into an adapter, allowing for generic lambdas to be used as filter predicates, this setup allows for a lot of leeway regarding the concrete predicates.
Definition at line 1214 of file iter-explorer.hpp.
Public Member Functions | |
template<typename FUN > | |
MutableFilter (SRC &&dataSrc, FUN &&filterFun) | |
template<typename COND > | |
void | andFilter (COND &&conjunctiveClause) |
remould existing predicate to require in addition the given clause to hold | |
template<typename COND > | |
void | andNotFilter (COND &&conjunctiveClause) |
remould existing predicate to require in addition the negation of the given clause to hold | |
void | disableFilter () |
discard filter predicates and disable any filtering | |
void | flipFilter () |
remould existing predicate to negate the meaning of the existing clause | |
template<typename COND > | |
void | orFilter (COND &&disjunctiveClause) |
remould existing predicate to require either the old OR the given new clause to hold | |
template<typename COND > | |
void | orNotFilter (COND &&disjunctiveClause) |
remould existing predicate to require either the old OR the negation of a new clause to hold | |
template<typename COND > | |
void | setNewFilter (COND &&entirelyDifferentPredicate) |
replace the existing predicate with the given, entirely different predicate | |
![]() | |
template<typename FUN > | |
Filter (SRC &&dataSrc, FUN &&filterFun) | |
bool | checkPoint () const |
void | expandChildren () |
refresh state when other layers manipulate the source sequence. More... | |
void | iterNext () |
SRC::reference | yield () const |
Private Types | |
using | _Filter = Filter< SRC > |
Private Member Functions | |
template<typename COND , class COMB > | |
void | remouldFilter (COND &&additionalClause, COMB buildCombinedClause) |
Additional Inherited Members | |
![]() | |
using | FilterPredicate = function< bool(SRC &)> |
![]() | |
bool | isDisabled () const |
void | pullFilter () |
SRC & | srcIter () const |
![]() | |
FilterPredicate | predicate_ |
|
inlineprivate |
boilerplate to remould the filter predicate in-place
additionalClause | additional functor object to combine |
buildCombinedClause | a generic lambda (important!) to define how exactly the old and the new predicate are to be combined |
buildCombinedClause
must capture its arguments, the existing functors by value. This is the key piece in the puzzle, since it effectively moves the existing functor into a new heap allocated storage. Definition at line 1352 of file iter-explorer.hpp.