Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
IterSource< TY > Class Template Referenceabstract

#include "lib/iter-source.hpp"

Description

template<typename TY>
class lib::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.

This base class is empty and makes no assumptions regarding identity, instantiation and copying.

See also
PlacementIndex::Table::_eachEntry_4check usage example
iter-source-test.cpp

Definition at line 79 of file iter-source.hpp.

Classes

struct  iterator
 

Public Types

using value_type = TY
 
using reference = TY &
 
using pointer = TY *
 

Static Public Attributes

static iterator EMPTY_SOURCE = iterator()
 storage for the empty data-source constant
 

Static Public Member Functions

static iterator build (IterSource &sourceImpl)
 build an iterator frontend for the given source,
 
static iterator build (IterSource *sourceImplObject)
 build an iterator frontend, thereby managing the given heap allocated source object instance.
 

Public Member Functions

virtual ~IterSource ()
 
virtual operator string () const
 is ABC
 

Friends

bool checkPoint (DataHandle const &, Pos const &pos)
 
void iterNext (DataHandle &source, Pos &pos)
 

Protected Types

using Pos = TY *
 
using DataHandle = shared_ptr< IterSource >
 

Protected Member Functions

virtual Pos firstResult ()=0
 iteration start: prepare the first element.
 
virtual void nextResult (Pos &pos)=0
 iteration step: switch on to the next element.
 
virtual void disconnect ()
 disconnect the data source / iteration frontend.
 

Static Private Member Functions

static iterator startIteration (DataHandle sourceHandle)
 
static void detach_without_destroy (IterSource *source)
 
static void destroy_managed_source (IterSource *source)
 

Constructor & Destructor Documentation

◆ ~IterSource()

template<typename TY >
virtual ~IterSource ( )
inlinevirtual

Definition at line 110 of file iter-source.hpp.

Member Typedef Documentation

◆ Pos

template<typename TY >
using Pos = TY*
protected

Definition at line 84 of file iter-source.hpp.

◆ DataHandle

template<typename TY >
using DataHandle = shared_ptr<IterSource>
protected

Definition at line 85 of file iter-source.hpp.

◆ value_type

template<typename TY >
using value_type = TY

Definition at line 170 of file iter-source.hpp.

◆ reference

template<typename TY >
using reference = TY&

Definition at line 171 of file iter-source.hpp.

◆ pointer

template<typename TY >
using pointer = TY*

Definition at line 172 of file iter-source.hpp.

Member Function Documentation

◆ firstResult()

template<typename TY >
virtual Pos firstResult ( )
protectedpure virtual

iteration start: prepare the first element.

may return NULL in case of empty data source

Implemented in WrappedLumieraIter< IT, ISO >, WrappedLumieraIter< SRC >, NummyGenerator, DiagnosticOutputSlot::OutputFramesLog, and TestSource.

◆ nextResult()

template<typename TY >
virtual void nextResult ( Pos pos)
protectedpure virtual

iteration step: switch on to the next element.

The pos pointer should be set to NULL to report iteration end

Implemented in NummyGenerator, DiagnosticOutputSlot::OutputFramesLog, and TestSource.

◆ disconnect()

template<typename TY >
virtual void disconnect ( )
inlineprotectedvirtual

disconnect the data source / iteration frontend.

Depending on the way the IterSource got created this might (or might not) be followed by destroying the data source.

Note
must not throw

Definition at line 105 of file iter-source.hpp.

Referenced by IterSource< TY >::destroy_managed_source(), and IterSource< TY >::detach_without_destroy().

+ Here is the caller graph for this function:

◆ operator string()

template<typename TY >
virtual operator string ( ) const
inlinevirtual

is ABC

< subclasses may offer diagnostics

Reimplemented in MaterialisedDiffBuffer.

Definition at line 113 of file iter-source.hpp.

◆ build() [1/2]

template<typename TY >
static iterator build ( IterSource< TY > &  sourceImpl)
inlinestatic

build an iterator frontend for the given source,

Note
the source is allocated separately and not owned by the iterator frontend

Definition at line 151 of file iter-source.hpp.

References IterSource< TY >::detach_without_destroy(), and IterSource< TY >::startIteration().

Referenced by lib::iter_source::eachEntry(), lib::iter_source::eachEntry(), lib::iter_source::singleVal(), lib::iter_source::transform(), and lib::iter_source::wrapIter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ build() [2/2]

template<typename TY >
static iterator build ( IterSource< TY > *  sourceImplObject)
inlinestatic

build an iterator frontend, thereby managing the given heap allocated source object instance.

Note
we take ownership and destroy the source when the last copy of the created iterator goes out of scope.

Definition at line 163 of file iter-source.hpp.

References IterSource< TY >::destroy_managed_source(), and IterSource< TY >::startIteration().

+ Here is the call graph for this function:

◆ startIteration()

template<typename TY >
static iterator startIteration ( DataHandle  sourceHandle)
inlinestaticprivate

Definition at line 178 of file iter-source.hpp.

Referenced by IterSource< TY >::build(), and IterSource< TY >::build().

+ Here is the caller graph for this function:

◆ detach_without_destroy()

template<typename TY >
static void detach_without_destroy ( IterSource< TY > *  source)
inlinestaticprivate

Definition at line 187 of file iter-source.hpp.

References IterSource< TY >::disconnect().

Referenced by IterSource< TY >::build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy_managed_source()

template<typename TY >
static void destroy_managed_source ( IterSource< TY > *  source)
inlinestaticprivate

Definition at line 195 of file iter-source.hpp.

References IterSource< TY >::disconnect().

Referenced by IterSource< TY >::build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ EMPTY_SOURCE

template<typename TY >
IterSource< TY >::iterator EMPTY_SOURCE = iterator()
static

storage for the empty data-source constant

Definition at line 168 of file iter-source.hpp.

Friends And Related Symbol Documentation

◆ checkPoint

template<typename TY >
bool checkPoint ( DataHandle const &  ,
Pos const &  pos 
)
friend

Definition at line 122 of file iter-source.hpp.

◆ iterNext

template<typename TY >
void iterNext ( DataHandle source,
Pos pos 
)
friend

Definition at line 128 of file iter-source.hpp.

+ Inheritance diagram for IterSource< TY >:
+ Collaboration diagram for IterSource< TY >:

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