67 #ifndef SRC_LIB_ITER_CHAIN_SEARCH_H 68 #define SRC_LIB_ITER_CHAIN_SEARCH_H 87 using lib::meta::disable_if;
94 buildSearchFilter (SRC&& dataSource)
96 return explore (forward<SRC> (dataSource))
111 return buildSearchFilter (forward<SRC> (dataSource))
112 .expand ([](
auto it){
return it; });
127 using Filter = decltype( buildSearchFilter(std::declval<SRC>()).asIterator() );
150 :
public _IterChainSetup<SRC>::Pipeline
152 using _Trait = _IterChainSetup<SRC>;
153 using _Base =
typename _Trait::Pipeline;
155 using Value =
typename _Base::value_type;
156 using Filter =
typename _Trait::Filter;
157 using Step =
typename _Trait::StepFunctor;
164 needsExpansion()
const 166 return _Base::depth() < stepChain_.size();
181 _Base::disableFilter();
192 _Base::__throw_if_empty();
193 if (not needsExpansion())
195 while (needsExpansion()
196 and _Base::checkPoint())
198 uint depth =_Base::depth();
199 _Base::expandChildren();
200 stepChain_[depth] (_Base::accessCurrentChildIter());
201 _Base::dropExhaustedChildren();
228 template<
typename FUN>
232 if (not this->empty())
234 Step nextStep{forward<FUN> (configureSearchStep)};
236 if (_Base::isDisabled())
240 stepChain_.emplace_back (move (nextStep));
253 template<
typename FUN>
254 disable_if<is_convertible<FUN, Value>,
258 addStep ([predicate{forward<FUN> (filterPredicate)}]
261 filter.setNewFilter (predicate);
273 search ([target](Value
const& currVal) {
return currVal == target; });
286 _Base::rootCurrent();
287 _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 ...