Lumiera  0.pre.03
»edit your freedom«
IterChainSearch< SRC > Class Template Reference

#include "lib/iter-chain-search.hpp"

Description

template<class SRC>
class lib::iter::IterChainSearch< SRC >

Iterator based linear search mechanism, with the ability to perform consecutive search with backtracking.

The IterChainSearch can be configured with a sequence of search goals (filter conditions), and will apply these in succession on the underlying iterator. It will search by linear search for the first hit of the first condition, and then continue to search from there matching on the second condition, and so on. After the first combination of matches is exhausted, the search will backtrack and try to evaluate the next combination, leading to a tree of on-demand search solutions.

Definition at line 158 of file iter-chain-search.hpp.

Public Member Functions

template<class SEQ >
 IterChainSearch (SEQ &&srcData)
 Build a chain-search mechanism based on the given source data sequence. More...
 
template<typename FUN >
IterChainSearch && addStep (FUN &&configureSearchStep)
 configure additional chained search condition. More...
 
IterChainSearch && clearFilter ()
 drop all search condition frames. More...
 
void iterNext ()
 
IterChainSearchoperator++ ()
 
template<typename FUN >
disable_if< is_convertible< FUN, Value >, IterChainSearch &&> search (FUN &&filterPredicate)
 attach additional search with the given filter predicate. More...
 
IterChainSearch && search (Value target)
 attach additional direct search for a given value. More...
 

Private Types

using _Base = typename _Trait::Pipeline
 
using _Trait = _IterChainSetup< SRC >
 
using Filter = typename _Trait::Filter
 
using Step = typename _Trait::StepFunctor
 
using Value = typename _Base::value_type
 

Private Member Functions

bool needsExpansion () const
 

Private Attributes

std::vector< Step > stepChain_
 Storage for a sequence of filter configuration functors.
 

Constructor & Destructor Documentation

◆ IterChainSearch()

IterChainSearch ( SEQ &&  srcData)
inlineexplicit

Build a chain-search mechanism based on the given source data sequence.

Remarks
iterators will be copied or moved as appropriate, while from a STL compliant container just a pair of (begin(), end()) iterators is retrieved; the latter is also the reason why a rvalue reference to STL container is rejected, since the container needs to reside elsewhere; only the iterator is wrapped here.

Definition at line 187 of file iter-chain-search.hpp.

References lib::iter::anonymous_namespace{iter-chain-search.hpp}::buildChainExplorer().

+ Here is the call graph for this function:

Member Function Documentation

◆ addStep()

IterChainSearch&& addStep ( FUN &&  configureSearchStep)
inline

configure additional chained search condition.

Parameters
amanipulation functor void(Filter&), which works on the current filter to possibly change its configuration.
Note
the given functor, lambda or function reference will be wrapped and adapted to conform to the required function signature. When using a generic lambda, the argument type Filter& is used for instantiation
Remarks
the additional chained search condition given here will be applied after matching all other conditions already in the filter chain. Each such condition is used to filter the underlying source iterator, i.e. pull it until finding an element to match the condition. Basically these conditions are not used in conjunction, but rather one after another. But since each such step in the chain is defined by a functor, which gets the previous filter configuration as argument, it is possible to build a step which extends or sharpens the preceding condition.

Definition at line 239 of file iter-chain-search.hpp.

◆ search() [1/2]

disable_if<is_convertible<FUN, Value>, IterChainSearch&& > search ( FUN &&  filterPredicate)
inline

attach additional search with the given filter predicate.

After successfully searching for all the conditions currently in the filter chain, the embedded iterator will finally be pulled until matching the given target value.

Remarks
adds a new layer on the stack of search conditions with a copy of the previously used iterator, and installs the given filter predicate therein.

Definition at line 265 of file iter-chain-search.hpp.

References steam::mobject::session::test::anonymous_namespace{scope-query-test.cpp}::filter().

+ Here is the call graph for this function:

◆ search() [2/2]

IterChainSearch&& search ( Value  target)
inline

attach additional direct search for a given value.

After successfully searching for all the conditions currently in the filter chain, the embedded iterator will finally be pulled until matching the given target value.

Definition at line 280 of file iter-chain-search.hpp.

◆ clearFilter()

IterChainSearch&& clearFilter ( )
inline

drop all search condition frames.

Remarks
the filter chain becomes empty, passing through the reset of the source sequence unaltered

Definition at line 292 of file iter-chain-search.hpp.

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

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