76 #ifndef SRC_LIB_ITER_CHAIN_SEARCH_H 77 #define SRC_LIB_ITER_CHAIN_SEARCH_H 96 using lib::meta::disable_if;
103 buildSearchFilter (SRC&& dataSource)
105 return explore (forward<SRC> (dataSource))
120 return buildSearchFilter (forward<SRC> (dataSource))
121 .expand ([](
auto it){
return it; });
136 using Filter = decltype( buildSearchFilter(std::declval<SRC>()).asIterator() );
159 :
public _IterChainSetup<SRC>::Pipeline
161 using _Trait = _IterChainSetup<SRC>;
162 using _Base =
typename _Trait::Pipeline;
164 using Value =
typename _Base::value_type;
165 using Filter =
typename _Trait::Filter;
166 using Step =
typename _Trait::StepFunctor;
173 needsExpansion()
const 175 return _Base::depth() < stepChain_.size();
190 _Base::disableFilter();
201 _Base::__throw_if_empty();
202 if (not needsExpansion())
204 while (needsExpansion()
205 and _Base::checkPoint())
207 uint depth =_Base::depth();
208 _Base::expandChildren();
209 stepChain_[depth] (_Base::accessCurrentChildIter());
210 _Base::dropExhaustedChildren();
237 template<
typename FUN>
241 if (not this->empty())
243 Step nextStep{forward<FUN> (configureSearchStep)};
245 if (_Base::isDisabled())
249 stepChain_.emplace_back (move (nextStep));
262 template<
typename FUN>
263 disable_if<is_convertible<FUN, Value>,
267 addStep ([predicate{forward<FUN> (filterPredicate)}]
270 filter.setNewFilter (predicate);
282 search ([target](Value
const& currVal) {
return currVal == target; });
295 _Base::rootCurrent();
296 _Base::disableFilter();
auto chainSearch(SRC &&srcData)
setup a chain search configuration by suitably wrapping the given container.
std::function< void(Filter &)> StepFunctor
each step in the chain is a functor to reconfigure the underlying filter
auto explore(IT &&srcSeq)
start building a IterExplorer by suitably wrapping the given iterable source.
bool filter(Placement< DummyMO > const &candidate)
a filter predicate to pick some objects from a resultset.
IterChainSearch(SEQ &&srcData)
Build a chain-search mechanism based on the given source data sequence.
std::vector< Step > stepChain_
Storage for a sequence of filter configuration functors.
Implementation namespace for support and library code.
IterChainSearch && search(Value target)
attach additional direct search for a given value.
IterChainSearch && addStep(FUN &&configureSearchStep)
configure additional chained search condition.
Iterator based linear search mechanism, with the ability to perform consecutive search with backtrack...
Lumiera error handling (C++ interface).
disable_if< is_convertible< FUN, Value >, IterChainSearch &&> search(FUN &&filterPredicate)
attach additional search with the given filter predicate.
Building tree expanding and backtracking evaluations within hierarchical scopes.
IterChainSearch && clearFilter()
drop all search condition frames.
auto buildChainExplorer(SRC &&dataSource)
define the chained-search mechanism: invoking filter.expandChildren() adds a new layer with the copy ...