Class sdm::iterator::FunctionIterator

template <typename TFunction typename TFunction>

Class List > sdm > iterator > FunctionIterator

The function iterator is an SDMS iterator generating functions from iterable possible inputs and outputs. More...

  • #include <function_iterator.hpp>

Inherits the following classes: sdm::Iterator, std::enable_shared_from_this< FunctionIterator< TFunction > >

Public Types

Type Name
typedef std::shared_ptr< ItemIterator > single_iterator_type

Public Types inherited from sdm::Iterator

See sdm::Iterator

Type Name
typedef TItem item_type

Public Functions

Type Name
FunctionIterator ()
FunctionIterator (const std::vector< std::shared_ptr< Item >> & possible_inputs, const std::vector< std::shared_ptr< ItemIterator >> & output_begin_iterators, const std::vector< std::shared_ptr< ItemIterator >> & output_end_iterators)
Construct a function iterator.
virtual std::shared_ptr< ItemIterator > copy () const
Copy function.
bool operator!= (const std::shared_ptr< ItemIterator > & other) const
virtual std::shared_ptr< Item > & operator* ()
Get a reference to the item.
virtual std::shared_ptr< ItemIterator > operator+ (number n) const
Get the n-step incremented iterator without modifying the current iterator.
virtual std::shared_ptr< ItemIterator > operator++ ()
Increment the iterator.
virtual std::shared_ptr< ItemIterator > operator+= (number n)
Increment the iterator of n steps.
virtual std::shared_ptr< Item > * operator-> ()
Get the address of the item.
bool operator== (const std::shared_ptr< ItemIterator > & other) const

Public Functions inherited from sdm::Iterator

See sdm::Iterator

Type Name
virtual std::shared_ptr< Iterator< TItem > > copy () const = 0
Copy function.
virtual bool operator!= (const std::shared_ptr< Iterator > & other) const = 0
Check if two iterators are differents.
virtual TItem & operator* () = 0
Get a reference to the item.
virtual std::shared_ptr< Iterator< TItem > > operator+ (number n) const = 0
Get the n-step incremented iterator without modifying the current iterator.
virtual std::shared_ptr< Iterator > operator++ () = 0
Increment the iterator.
virtual std::shared_ptr< Iterator< TItem > > operator+= (number n) = 0
Increment the iterator of n steps.
virtual TItem * operator-> () = 0
Get the address of the item.
virtual bool operator== (const std::shared_ptr< Iterator > & other) const = 0
Check if two iterators are equals. This function is used to check the end.
virtual ~Iterator ()

Protected Attributes

Type Name
std::shared_ptr< ItemIterator > output_iterator_
The output iterator.
std::vector< std::shared_ptr< Item > > possible_inputs_
The inputs list.
std::shared_ptr< Item > temporary_item

Detailed Description

Given an list of possible inputs and a list of iterators over possible outputs, the function iterator will generate all possible functions.

Template parameters:

  • TFunction the function type. This type of function needs to accept a constructor of the form MyFunction(const std::vector<std::shared_ptr< Item >> &inputs, const std::vector<std::shared_ptr< Item >> &outputs);

Public Types Documentation

typedef single_iterator_type

using sdm::iterator::FunctionIterator< TFunction >::single_iterator_type =  std::shared_ptr<ItemIterator>;

Public Functions Documentation

function FunctionIterator [1/2]

sdm::iterator::FunctionIterator::FunctionIterator () 

function FunctionIterator [2/2]

sdm::iterator::FunctionIterator::FunctionIterator (
    const std::vector< std::shared_ptr< Item >> & possible_inputs,
    const std::vector< std::shared_ptr< ItemIterator >> & output_begin_iterators,
    const std::vector< std::shared_ptr< ItemIterator >> & output_end_iterators
) 

Parameters:

  • possible_inputs the list of possible inputs.
  • output_begin_iterators the output begin iterators (one by input)
  • output_end_iterators the output end iterators (one by input)

function copy

virtual std::shared_ptr< ItemIterator > sdm::iterator::FunctionIterator::copy () const

Returns:

the copied iterator

Implements sdm::Iterator::copy

function operator!=

bool sdm::iterator::FunctionIterator::operator!= (
    const std::shared_ptr< ItemIterator > & other
) const

function operator*

virtual std::shared_ptr< Item > & sdm::iterator::FunctionIterator::operator* () 

Returns:

TItem& the item

Implements sdm::Iterator::operator*

function operator+

virtual std::shared_ptr< ItemIterator > sdm::iterator::FunctionIterator::operator+ (
    number n
) const

Parameters:

  • n the number of step

Returns:

the n-step incremented copy iterator

Implements sdm::Iterator::operator+

function operator++

virtual std::shared_ptr< ItemIterator > sdm::iterator::FunctionIterator::operator++ () 

Returns:

the incremented iterator

Implements sdm::Iterator::operator++

function operator+=

virtual std::shared_ptr< ItemIterator > sdm::iterator::FunctionIterator::operator+= (
    number n
) 

Parameters:

  • n the number of step

Returns:

the n-step incremented iterator

Implements sdm::Iterator::operator+=

function operator->

virtual std::shared_ptr< Item > * sdm::iterator::FunctionIterator::operator-> () 

Returns:

TItem* the address of the item

Implements sdm::Iterator::operator->

function operator==

bool sdm::iterator::FunctionIterator::operator== (
    const std::shared_ptr< ItemIterator > & other
) const

Protected Attributes Documentation

variable output_iterator_

std::shared_ptr<ItemIterator> sdm::iterator::FunctionIterator< TFunction >::output_iterator_;

variable possible_inputs_

std::vector<std::shared_ptr<Item> > sdm::iterator::FunctionIterator< TFunction >::possible_inputs_;

variable temporary_item

std::shared_ptr<Item> sdm::iterator::FunctionIterator< TFunction >::temporary_item;

The documentation for this class was generated from the following file src/sdm/utils/struct/iterator/function_iterator.hpp