Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
StopTrigger< SRC > Class Template Reference

#include "lib/iter-explorer.hpp"

Description

template<class SRC>
class lib::iter_explorer::StopTrigger< SRC >

Decorator for IterExplorer to cut iteration once a predicate ceases to be true. Similar to Filter, the given functor is adapted as appropriate, yet is required to yield a bool convertible result. The functor will be evaluated whenever the »exhausted« state of the resulting iterator is checked, on each access and before iteration; this evaluation is not cached (and thus could also detect ongoing state changes by side-effect).

Note
usually an exhausted iterator will be abandoned — however, since the test is not cached, the iterator might become active again, if for some reason the condition becomes true again (e.g. as result of expandChildern())

Definition at line 1379 of file iter-explorer.hpp.

Public Member Functions

 StopTrigger ()=default
 
template<typename FUN >
 StopTrigger (SRC &&dataSrc, FUN &&condition)
 
bool checkPoint () const
 adapt the iteration control API for IterableDecorator: check the stop condition first and block eventually
 
- Public Member Functions inherited from IterStateCore< SRC >
bool checkPoint () const
 
IT::reference yield () const
 
void iterNext ()
 

Private Types

using Core = IterStateCore< SRC >
 
using Cond = function< bool(SRC &)>
 

Private Attributes

Cond whileCondition_
 

Additional Inherited Members

- Protected Member Functions inherited from IterStateCore< SRC >
SRC & srcIter () const
 

Constructor & Destructor Documentation

◆ StopTrigger() [1/2]

template<class SRC >
StopTrigger ( )
default

◆ StopTrigger() [2/2]

template<class SRC >
template<typename FUN >
StopTrigger ( SRC &&  dataSrc,
FUN &&  condition 
)
inline

Definition at line 1395 of file iter-explorer.hpp.

Member Typedef Documentation

◆ Core

template<class SRC >
using Core = IterStateCore<SRC>
private

Definition at line 1384 of file iter-explorer.hpp.

◆ Cond

template<class SRC >
using Cond = function<bool(SRC&)>
private

Definition at line 1385 of file iter-explorer.hpp.

Member Function Documentation

◆ checkPoint()

template<class SRC >
bool checkPoint ( ) const
inline

adapt the iteration control API for IterableDecorator: check the stop condition first and block eventually

Definition at line 1404 of file iter-explorer.hpp.

References IterStateCore< SRC >::checkPoint(), IterStateCore< SRC >::srcIter(), and StopTrigger< SRC >::whileCondition_.

+ Here is the call graph for this function:

Member Data Documentation

◆ whileCondition_

template<class SRC >
Cond whileCondition_
private

Definition at line 1387 of file iter-explorer.hpp.

Referenced by StopTrigger< SRC >::checkPoint().

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

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