Lumiera  0.pre.03
»edityourfreedom«
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 88 of file iter-source.hpp.

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static iterator EMPTY_SOURCE
 storage for the empty data-source constant More...
 

Classes

struct  iterator
 

Friends

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

Protected Types

typedef shared_ptr< IterSourceDataHandle
 
typedef TY * Pos
 

Protected Member Functions

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

Static Private Member Functions

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

Member Typedef Documentation

◆ Pos

typedef TY* Pos
protected

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

◆ DataHandle

typedef shared_ptr<IterSource> DataHandle
protected

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

◆ value_type

using value_type = TY

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

◆ reference

using reference = TY&

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

◆ pointer

using pointer = TY*

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

Constructor & Destructor Documentation

◆ ~IterSource()

virtual ~IterSource ( )
inlinevirtual

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

Member Function Documentation

◆ firstResult()

virtual Pos firstResult ( )
protectedpure virtual

iteration start: prepare the first element.

may return NULL in case of empty data source

Implemented in DiagnosticOutputSlot::OutputFramesLog, and WrappedLumieraIter< SRC >.

◆ nextResult()

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 DiagnosticOutputSlot::OutputFramesLog, and WrappedLumieraIter< SRC >.

◆ disconnect()

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 114 of file iter-source.hpp.

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

+ Here is the caller graph for this function:

◆ operator string()

virtual operator string ( ) const
inlinevirtual

is ABC

< subclasses may offer diagnostics

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

◆ build() [1/2]

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 160 of file iter-source.hpp.

Referenced by lib::iter_source::eachEntry(), IterExploreSource< VAL >::IterExploreSource(), MutationMessage::MutationMessage(), lib::iter_source::singleVal(), lib::iter_source::transform(), and lib::iter_source::wrapIter().

+ Here is the caller graph for this function:

◆ build() [2/2]

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 173 of file iter-source.hpp.

◆ startIteration()

static iterator startIteration ( DataHandle  sourceHandle)
inlinestaticprivate

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

Referenced by IterSource< const TestFrame >::build().

+ Here is the caller graph for this function:

◆ detach_without_destroy()

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

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

Referenced by IterSource< const TestFrame >::build().

+ Here is the caller graph for this function:

◆ destroy_managed_source()

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

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

Referenced by IterSource< const TestFrame >::build().

+ Here is the caller graph for this function:

Member Data Documentation

◆ EMPTY_SOURCE

IterSource< TY >::iterator EMPTY_SOURCE
static

storage for the empty data-source constant

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

Friends And Related Function Documentation

◆ checkPoint

bool checkPoint ( DataHandle const &  ,
Pos const &  pos 
)
friend

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

◆ iterNext

void iterNext ( DataHandle source,
Pos pos 
)
friend

Definition at line 137 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: