Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
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.
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.
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>
Classes | |
struct | _IterT< IT > |
struct | _MapT< MAP > |
struct | _PairIterT< IT > |
struct | _RangeT< IT > |
struct | _SeqT< CON > |
struct | _TransformIterT< IT, FUN > |
struct | IterSource< TY >::iterator |
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... | |
class | WrappedLumieraIter< IT, ISO > |
Standard implementation of the IterSource interface: a wrapped "Lumiera Forward Iterator". More... | |
Functions | |
template<class MAP > | |
_MapT< MAP >::KeyIter | eachDistinctKey (MAP &map) |
template<class CON > | |
_SeqT< CON >::Iter | eachEntry (CON &container) |
template<class IT > | |
_RangeT< IT >::Iter | eachEntry (IT const &begin, IT const &end) |
template<class MAP > | |
_MapT< MAP >::KeyIter | eachMapKey (MAP &map) |
template<class MAP > | |
_MapT< MAP >::ValIter | eachMapVal (MAP &map) |
template<class MAP > | |
_MapT< MAP >::ValIter | eachValForKey (MAP &map, typename _MapT< MAP >::Key key) |
template<typename VAL > | |
auto | singleVal (VAL &&something) |
an IterSource frontend to return just a single value once. More... | |
template<class IT > | |
_PairIterT< IT >::KeyIter | takePairFirst (IT &&source) |
template<class IT > | |
_PairIterT< IT >::ValIter | takePairSecond (IT &&source) |
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. More... | |
template<class IT > | |
_IterT< IT >::Iter | wrapIter (IT &&source) |
wraps a given Lumiera Forward Iterator, exposing just a IterSource based frontend. | |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |
struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_IterT |
Class Members | ||
---|---|---|
typedef typename remove_reference< IT >::type |
Src | |
typedef typename value_type | Val | |
typedef typename IterSource < Val >::iterator |
Iter |
struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_MapT |
Class Members | ||
---|---|---|
typedef typename key_type | Key | |
typedef typename second_type | Val | |
typedef typename IterSource < Key >::iterator |
KeyIter | |
typedef typename IterSource < Val >::iterator |
ValIter |
struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_RangeT |
Class Members | ||
---|---|---|
typedef typename value_type | Val | |
typedef typename IterSource < Val >::iterator |
Iter |
struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_SeqT |
Class Members | ||
---|---|---|
typedef typename value_type | Val | |
typedef typename IterSource < Val >::iterator |
Iter |
struct lib::iter_source::anonymous_namespace{iter-source.hpp}::_TransformIterT |
Class Members | ||
---|---|---|
typedef typename remove_reference< IT >::type |
Src | |
typedef typename _Fun< FUN >::Ret | ResVal | |
typedef TransformIter< Src, ResVal > |
TransIter | |
typedef typename IterSource < ResVal >::iterator |
Iter |
auto lib::iter_source::singleVal | ( | VAL && | something | ) |
an IterSource frontend to return just a single value once.
Definition at line 378 of file iter-source.hpp.
References IterSource< TY >::build(), lib::iter_source::singleVal(), and lib::singleValIterator().
Referenced by lib::iter_source::singleVal().
_TransformIterT<IT,FUN>::Iter lib::iter_source::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.
This convenience shortcut can be used to build a processing chain; the resulting IterSource will hide any detail types involved.
Definition at line 398 of file iter-source.hpp.
References IterSource< TY >::build(), IterAdapter< Pos, DataHandle >::source(), lib::iter_source::transform(), and lib::transformIterator().
Referenced by lib::iter_source::transform().
_MapT<MAP>::KeyIter lib::iter_source::eachMapKey | ( | MAP & | map | ) |
Definition at line 414 of file iter-source.hpp.
References lib::diff::test::anonymous_namespace{diff-tree-application-simple-test.cpp}::contents(), lib::iter_source::eachMapKey(), and lib::iter_source::wrapIter().
Referenced by lib::iter_source::eachMapKey().
_MapT<MAP>::ValIter lib::iter_source::eachMapVal | ( | MAP & | map | ) |
Definition at line 428 of file iter-source.hpp.
References lib::diff::test::anonymous_namespace{diff-tree-application-simple-test.cpp}::contents(), lib::iter_source::eachMapVal(), and lib::iter_source::wrapIter().
Referenced by lib::iter_source::eachMapVal().
_MapT<MAP>::KeyIter lib::iter_source::eachDistinctKey | ( | MAP & | map | ) |
Definition at line 444 of file iter-source.hpp.
References lib::diff::test::anonymous_namespace{diff-tree-application-simple-test.cpp}::contents(), lib::filterRepetitions(), and lib::iter_source::wrapIter().
_MapT<MAP>::ValIter lib::iter_source::eachValForKey | ( | MAP & | map, |
typename _MapT< MAP >::Key | key | ||
) |
Definition at line 459 of file iter-source.hpp.
_SeqT<CON>::Iter lib::iter_source::eachEntry | ( | CON & | container | ) |
container | a STL-like container, providing
|
begin
and excluding end
. Definition at line 478 of file iter-source.hpp.
References IterSource< TY >::build(), lib::diff::test::anonymous_namespace{diff-tree-application-simple-test.cpp}::contents(), and lib::iter_source::eachEntry().
Referenced by lib::iter_source::eachEntry().
_RangeT<IT>::Iter lib::iter_source::eachEntry | ( | IT const & | begin, |
IT const & | end | ||
) |
Definition at line 493 of file iter-source.hpp.
References IterSource< TY >::build(), lib::diff::test::anonymous_namespace{diff-tree-application-simple-test.cpp}::contents(), and lib::iter_source::eachEntry().