42#ifndef LIB_ITER_SOURCE_H
43#define LIB_ITER_SOURCE_H
62 using std::shared_ptr;
113 operator string() const
131 source->nextResult(pos);
180 REQUIRE (sourceHandle);
181 Pos first = sourceHandle->firstResult();
182 return {move(sourceHandle), first};
189 WARN_IF (!source, library,
"IterSource deleter called with NULL source pointer");
197 WARN_IF (!source, library,
"IterSource deleter called with NULL source pointer");
208 template<
typename TY>
221 template<class IT, class ISO = IterSource<typename meta::ValueTypeBinding<IT>::value_type>>
259 :
src_(forward<IT>(orig))
273 namespace iter_source {
279 using Val = CON::iterator::value_type;
286 using Val = IT::value_type;
293 using Key = MAP::key_type;
294 using Val = MAP::value_type::second_type;
303 using Src = std::remove_reference<IT>::type;
304 using Val = Src::value_type;
308 template<
class IT,
class FUN>
311 using Src = std::remove_reference<IT>::type;
320 using Src = std::remove_reference<IT>::type;
327 using KeyType = std::remove_const<ConstKeyType>::type;
338 _PairIterT<IT>::KeyIter
345 _PairIterT<IT>::ValIter
362 using Src = _IterT<IT>::Src;
363 using Val = _IterT<IT>::Val;
374 template<
typename VAL>
379 using Val = _IterT<Src>::Val;
394 template<
class IT,
class FUN>
395 _TransformIterT<IT,FUN>::Iter
398 using ValType = _TransformIterT<IT,FUN>::ResVal;
399 using TransIT = _TransformIterT<IT,FUN>::TransIter;
416 Range contents (map.begin(), map.end());
417 return wrapIter (takePairFirst (contents));
430 Range contents (map.begin(), map.end());
431 return wrapIter (takePairSecond(contents));
442 eachDistinctKey (MAP& map)
446 Range contents (map.begin(), map.end());
457 eachValForKey (MAP& map,
typename _MapT<MAP>::Key key)
459 using Pos = MAP::iterator;
462 std::pair<Pos,Pos> valuesForKey = map.equal_range(key);
463 Range contents (valuesForKey.first, valuesForKey.second);
464 return wrapIter (takePairSecond(contents));
478 using ValType = _SeqT<CON>::Val;
481 Range contents (container.begin(), container.end());
493 using ValType = _RangeT<IT>::Val;
496 Range contents (begin, end);
Adapter for building an implementation of the »Lumiera Forward Iterator« concept.
ConRef source()
allow derived classes to access backing container
Iteration source interface to abstract a data source, which then can be accessed through IterAdapter ...
shared_ptr< IterSource > DataHandle
static void detach_without_destroy(IterSource *source)
friend void iterNext(DataHandle &source, Pos &pos)
virtual Pos firstResult()=0
iteration start: prepare the first element.
static iterator build(IterSource *sourceImplObject)
build an iterator frontend, thereby managing the given heap allocated source object instance.
static iterator startIteration(DataHandle sourceHandle)
static iterator build(IterSource &sourceImpl)
build an iterator frontend for the given source,
friend bool checkPoint(DataHandle const &, Pos const &pos)
virtual void disconnect()
disconnect the data source / iteration frontend.
virtual void nextResult(Pos &pos)=0
iteration step: switch on to the next element.
static void destroy_managed_source(IterSource *source)
static iterator EMPTY_SOURCE
storage for the empty data-source constant
Accessing a STL element range through a Lumiera forward iterator, An instance of this iterator adapte...
Standard implementation of the IterSource interface: a wrapped "Lumiera Forward Iterator".
WrappedLumieraIter(IT &&orig)
void nextResult(Pos &pos)
WrappedLumieraIter(IT const &orig)
Pos firstResult()
iteration start: prepare the first element.
IT const & wrappedIter() const
Any copy and copy construction prohibited.
Helper template(s) for creating Lumiera Forward Iterators.
_PairIterT< IT >::ValIter takePairSecond(IT &&source)
MAP::value_type::second_type Val
lib::meta::_Fun< FUN >::Ret ResVal
std::remove_reference< IT >::type Src
CON::iterator::value_type Val
_PairIterT< IT >::KeyIter takePairFirst(IT &&source)
TransformIter< Src, ResVal > TransIter
_TransformIterT< IT, FUN >::Iter transform(IT &&source, FUN processingFunc)
pipes a given Lumiera Forward Iterator through a transformation function and wraps the resulting tran...
auto singleVal(VAL &&something)
an IterSource frontend to return just a single value once.
_MapT< MAP >::KeyIter eachMapKey(MAP &map)
_IterT< IT >::Iter wrapIter(IT &&source)
wraps a given Lumiera Forward Iterator, exposing just a IterSource based frontend.
_MapT< MAP >::ValIter eachMapVal(MAP &map)
_SeqT< CON >::Iter eachEntry(CON &container)
Implementation namespace for support and library code.
auto filterRepetitions(IT const &source)
filters away repeated values emitted by source iterator
auto transformIterator(IT const &src, FUN processingFunc)
Build a TransformIter: convenience free function shortcut, picking up the involved types automaticall...
auto singleValIterator(VAL &&something)
Build a SingleValIter: convenience free function shortcut, to pick up just any value and wrap it as L...
Mix-Ins to allow or prohibit various degrees of copying and cloning.
PairType::second_type ValType
std::remove_const< ConstKeyType >::type KeyType
static KeyType takeFirst(PairType const &pair)
PairType::first_type ConstKeyType
TransformIter< Src, KeyType > KeyIter
std::remove_reference< IT >::type Src
static ValType takeSecond(PairType const &pair)
TransformIter< Src, ValType > ValIter