![]() |
Lumiera 0.pre.04
»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 | |
| MutableFilter ()=default | |
| 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 | |
| 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 | |
| void | flipFilter () |
| remould existing predicate to negate the meaning of the existing clause | |
| template<typename COND > | |
| void | setNewFilter (COND &&entirelyDifferentPredicate) |
| replace the existing predicate with the given, entirely different predicate | |
| void | disableFilter () |
| discard filter predicates and disable any filtering | |
Public Member Functions inherited from Filter< SRC > | |
| 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 () |
Private Types | |
| using | _Filter = Filter< SRC > |
Private Member Functions | |
| template<typename COND , class COMB > | |
| void | remouldFilter (COND &&additionalClause, COMB buildCombinedClause) |
Additional Inherited Members | |
Protected Types inherited from Filter< SRC > | |
| using | FilterPredicate = function< bool(SRC &)> |
Protected Member Functions inherited from Filter< SRC > | |
| SRC & | srcIter () const |
| bool | isDisabled () const |
| void | pullFilter () |
Protected Attributes inherited from Filter< SRC > | |
| FilterPredicate | predicate_ |
|
default |
|
inline |
Definition at line 1225 of file iter-explorer.hpp.
Definition at line 1217 of file iter-explorer.hpp.
|
inline |
remould existing predicate to require in addition the given clause to hold
Definition at line 1235 of file iter-explorer.hpp.
References MutableFilter< SRC >::remouldFilter().
Here is the call graph for this function:
|
inline |
remould existing predicate to require in addition the negation of the given clause to hold
Definition at line 1251 of file iter-explorer.hpp.
References MutableFilter< SRC >::remouldFilter().
Here is the call graph for this function:
|
inline |
remould existing predicate to require either the old OR the given new clause to hold
Definition at line 1267 of file iter-explorer.hpp.
References MutableFilter< SRC >::remouldFilter().
Here is the call graph for this function:
|
inline |
remould existing predicate to require either the old OR the negation of a new clause to hold
Definition at line 1283 of file iter-explorer.hpp.
References MutableFilter< SRC >::remouldFilter().
Here is the call graph for this function:
|
inline |
remould existing predicate to negate the meaning of the existing clause
Definition at line 1298 of file iter-explorer.hpp.
References MutableFilter< SRC >::remouldFilter().
Here is the call graph for this function:
|
inline |
replace the existing predicate with the given, entirely different predicate
Definition at line 1314 of file iter-explorer.hpp.
References MutableFilter< SRC >::remouldFilter().
Here is the call graph for this function:
|
inline |
discard filter predicates and disable any filtering
Definition at line 1328 of file iter-explorer.hpp.
|
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.
References lib::iter_explorer::ACCEPT_ALL.
Referenced by MutableFilter< SRC >::andFilter(), MutableFilter< SRC >::andNotFilter(), MutableFilter< SRC >::flipFilter(), MutableFilter< SRC >::orFilter(), MutableFilter< SRC >::orNotFilter(), and MutableFilter< SRC >::setNewFilter().
Here is the caller graph for this function:
Inheritance diagram for MutableFilter< SRC >:
Collaboration diagram for MutableFilter< SRC >: