Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
iter-source.hpp File Reference

Extension module to build an opaque data source, accessible as Lumiera Forward Iterator. More...

Go to the source code of this file.

Description

Extension module to build an opaque data source, accessible as Lumiera Forward Iterator.

It is based on combining an IterAdapter with classical polymorphism; here, the data source, which is addressed by IderAdapter through the "iteration control API", is abstracted behind an interface (with virtual functions). Together this allows to build a simple data source type, without needing to disclose details of the implementation.

Todo:
the design used for the "iteration control API" is misaligned with the purpose of this adapter. Rather, it should be shaped similar to IterStateWrapper with three control functions //////////////////////////////////////TICKET #1125

Standard Adapters

As a complement, this header contains a generic implementation of the IterSource interface by wrapping an existing Lumiera Forward Iterator. Using this WrappedLumieraIter, the details of this wrapped source iterator remain opaque. To ease the use of this adapter, a selection of free functions is provided, allowing to build opaque "all elements" or "all keys" iterators for various STL containers.

See also
iter-adapter.hpp
itertool.hpp
iter-source-test.cpp

Definition in file iter-source.hpp.

#include "lib/meta/util.hpp"
#include "lib/iter-adapter.hpp"
#include "lib/itertools.hpp"
#include "lib/nocopy.hpp"
#include <type_traits>
#include <utility>
#include <string>
#include <memory>

Namespaces

namespace  lib
 Implementation namespace for support and library code.
 
namespace  lib::iter_source
 
namespace  lib::iter_source::anonymous_namespace{iter-source.hpp}
 

Classes

class  IterSource< TY >
 Iteration source interface to abstract a data source, which then can be accessed through IterAdapter as a frontend, allowing to pull individual elements until exhaustion. More...
 
struct  IterSource< TY >::iterator
 
class  WrappedLumieraIter< IT, ISO >
 Standard implementation of the IterSource interface: a wrapped "Lumiera Forward Iterator". More...
 
struct  _SeqT< CON >
 
struct  _RangeT< IT >
 
struct  _MapT< MAP >
 
struct  _IterT< IT >
 
struct  _TransformIterT< IT, FUN >
 
struct  _PairIterT< IT >
 

Functions

template<class IT >
_PairIterT< IT >::KeyIter takePairFirst (IT &&source)
 
template<class IT >
_PairIterT< IT >::ValIter takePairSecond (IT &&source)
 
template<class IT >
_IterT< IT >::Iter wrapIter (IT &&source)
 wraps a given Lumiera Forward Iterator, exposing just a IterSource based frontend.
 
template<typename VAL >
auto singleVal (VAL &&something)
 an IterSource frontend to return just a single value once.
 
template<class IT , class FUN >
_TransformIterT< IT, FUN >::Iter transform (IT &&source, FUN processingFunc)
 pipes a given Lumiera Forward Iterator through a transformation function and wraps the resulting transforming Iterator, exposing just an IterSource.
 
template<class MAP >
_MapT< MAP >::KeyIter eachMapKey (MAP &map)
 
template<class MAP >
_MapT< MAP >::ValIter eachMapVal (MAP &map)
 
template<class MAP >
_MapT< MAP >::KeyIter eachDistinctKey (MAP &map)
 
template<class MAP >
_MapT< MAP >::ValIter eachValForKey (MAP &map, typename _MapT< MAP >::Key key)
 
template<class CON >
_SeqT< CON >::Iter eachEntry (CON &container)
 
template<class IT >
_RangeT< IT >::Iter eachEntry (IT const &begin, IT const &end)
 

Class Documentation

◆ lib::iter_source::anonymous_namespace{iter-source.hpp}::_SeqT

struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_SeqT
Class Members
typedef value_type Val
typedef iterator Iter
+ Collaboration diagram for _SeqT< CON >:

◆ lib::iter_source::anonymous_namespace{iter-source.hpp}::_RangeT

struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_RangeT
Class Members
typedef value_type Val
typedef iterator Iter
+ Collaboration diagram for _RangeT< IT >:

◆ lib::iter_source::anonymous_namespace{iter-source.hpp}::_MapT

struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_MapT
Class Members
typedef key_type Key
typedef second_type Val
typedef iterator KeyIter
typedef iterator ValIter
+ Collaboration diagram for _MapT< MAP >:

◆ lib::iter_source::anonymous_namespace{iter-source.hpp}::_IterT

struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_IterT
Class Members
typedef type Src
typedef value_type Val
typedef iterator Iter
+ Collaboration diagram for _IterT< IT >:

◆ lib::iter_source::anonymous_namespace{iter-source.hpp}::_TransformIterT

struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_TransformIterT
Class Members
typedef type Src
typedef Ret ResVal
typedef TransformIter< Src, ResVal > TransIter
typedef iterator Iter
+ Collaboration diagram for _TransformIterT< IT, FUN >: