INET Framework for OMNeT++/OMNEST
inet::physicallayer::MultiDimMappingIterator< Interpolator > Class Template Reference

Implementation of the MappingIterator-interface which is able to iterate over every value in a MultiDimMapping. More...

#include <MappingUtils.h>

Inheritance diagram for inet::physicallayer::MultiDimMappingIterator< Interpolator >:
inet::physicallayer::MappingIterator inet::physicallayer::ConstMappingIterator

Public Member Functions

 MultiDimMappingIterator (MultiDimMapping< Interpolator > &pMapping)
 Initializes the Iterator for the passed MultiDimMapping and sets its position two the first entry of the passed MultiDimMapping. More...
 
 MultiDimMappingIterator (MultiDimMapping< Interpolator > &pMapping, const Argument &pos)
 Intializes the Iterator for the passed MultiDimMapping and sets its position two the passed position. More...
 
 MultiDimMappingIterator (const MultiDimMappingIterator &o)
 
virtual ~MultiDimMappingIterator ()
 Frees the memory allocated for the sub mappings. More...
 
void jumpTo (const Argument &pos) override
 Lets the iterator point to the passed position. More...
 
void iterateTo (const Argument &pos) override
 Iterates to the specified position. More...
 
virtual void next () override
 Iterates to the next position of the function. More...
 
virtual bool inRange () const override
 Returns true if the current position of the iterator is in range of the function. More...
 
virtual const ArgumentgetPosition () const override
 Returns the current position of the iterator. More...
 
virtual const ArgumentgetNextPosition () const override
 returns the next position a call to "next()" would jump to. More...
 
virtual argument_value_t getValue () const override
 Returns the value of the underlying mapping at the current position. More...
 
virtual void jumpToBegin () override
 Lets the iterator point to the begin of the function. More...
 
virtual bool hasNext () const override
 Returns true if the iterator has a valid next value a call to "next()" could jump to. More...
 
virtual void setValue (argument_value_cref_t value) override
 Changes the value of the function at the current position. More...
 
- Public Member Functions inherited from inet::physicallayer::MappingIterator
 MappingIterator ()
 
virtual ~MappingIterator ()
 
- Public Member Functions inherited from inet::physicallayer::ConstMappingIterator
 ConstMappingIterator ()
 
virtual ~ConstMappingIterator ()
 
 ConstMappingIterator (const ConstMappingIterator &)
 Copy constructor. More...
 
ConstMappingIteratoroperator= (const ConstMappingIterator &)
 ConstMappingIterator assignment operator. More...
 
void swap (ConstMappingIterator &)
 Swaps data with another ConstMappingIterator. More...
 

Protected Types

typedef InterpolateableMap< Interpolator< std::map< argument_value_t, Mapping * > > > interpolator_map_type
 The templated InterpolateableMap the underlying Mapping uses std::map as storage type. More...
 
typedef interpolator_map_type::interpolated interpolated
 
typedef interpolator_map_type::iterator_intpl iterator
 
typedef interpolator_map_type::const_iterator_intpl const_iterator
 

Protected Member Functions

void updateSubIterator (const Argument &pos)
 Helper method which updates the sub-iterator for the passed position. More...
 
void updateSubIterator ()
 Helper method which updates the sub-iterator and sets the position of the sub-iterator to its beginning. More...
 
void updateNextPosition ()
 Helper method which updates the nextPosition member. More...
 

Protected Attributes

const MultiDimMapping< Interpolator > & mapping
 The MultiDimmapping to iterate over. More...
 
iterator valueIt
 Iterator storing the current position inside the underlying Mappings sub-mapping map. More...
 
interpolated subMapping
 The sub-mapping of the sub-mapping map at the current position. More...
 
MappingIteratorsubIterator
 An iterator for the sub-mapping which points two the current position in the next dimensions. More...
 
Argument position
 The current position in every Dimension of this Iterator. More...
 
Argument nextPosition
 The position a call to "next()" would jump to. More...
 

Private Member Functions

MultiDimMappingIteratoroperator= (const MultiDimMappingIterator &)
 Assignment operator is not allowed. More...
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::ConstMappingIterator
typedef Argument::mapped_type argument_value_t
 
typedef Argument::mapped_type_cref argument_value_cref_t
 

Detailed Description

template<template< typename > class Interpolator>
class inet::physicallayer::MultiDimMappingIterator< Interpolator >

Implementation of the MappingIterator-interface which is able to iterate over every value in a MultiDimMapping.

As the MultiDimMapping has a tree-like structure of sub-mappings to represent multiple dimensions, the MultiDimIterator consist of a number of sub-MultiDimIterator to represent the current position inside the sub-mappings. So every sub-mapping-iterator represents one dimension and the and Iterator to next Dimensions. The last iterator is an TimeMappingIterator.

Iteration works by sub-iterator-first-iteration. Which means that at first the sub-iterator at the current position is iterated to its end before the position inside the dimension of this iterator is increased. This assures the iteration order demanded by the MappingIterator-interface.

Author
Karl Wessel

Member Typedef Documentation

template<template< typename > class Interpolator>
typedef interpolator_map_type::const_iterator_intpl inet::physicallayer::MultiDimMappingIterator< Interpolator >::const_iterator
protected
template<template< typename > class Interpolator>
typedef interpolator_map_type::interpolated inet::physicallayer::MultiDimMappingIterator< Interpolator >::interpolated
protected
template<template< typename > class Interpolator>
typedef InterpolateableMap<Interpolator<std::map<argument_value_t, Mapping *> > > inet::physicallayer::MultiDimMappingIterator< Interpolator >::interpolator_map_type
protected

The templated InterpolateableMap the underlying Mapping uses std::map as storage type.

template<template< typename > class Interpolator>
typedef interpolator_map_type::iterator_intpl inet::physicallayer::MultiDimMappingIterator< Interpolator >::iterator
protected

Constructor & Destructor Documentation

template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMappingIterator< Interpolator >::MultiDimMappingIterator ( MultiDimMapping< Interpolator > &  pMapping)
inline

Initializes the Iterator for the passed MultiDimMapping and sets its position two the first entry of the passed MultiDimMapping.

1519  :
1520  MappingIterator(), mapping(pMapping),
1521  valueIt(pMapping.entries.beginIntpl()),
1522  subMapping(0), subIterator(nullptr),
1523  position(), nextPosition()
1524  {
1526  if (!subMapping.isInterpolated && *subMapping) {
1527  subIterator = (*subMapping)->createIterator();
1530  }
1531  else {
1532  position = Argument(mapping.dimensions);
1533  }
1535 
1537  }
virtual const Argument & getPosition() const =0
Returns the current position of the iterator.
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
MappingIterator()
Definition: MappingBase.h:1221
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
Argument nextPosition
The position a call to "next()" would jump to.
Definition: MappingUtils.h:1417
void setArgValue(const Argument::key_type &dim, Argument::mapped_type_cref value)
Changes the value for the specified dimension.
Definition: MappingBase.cc:112
key_cref_type getPosition() const
Returns the current position of the iterator.
Definition: Interpolation.h:758
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
interpolated getValue() const
Returns the interpolated value at the current position of the Iterator.
Definition: Interpolation.h:739
void updateNextPosition()
Helper method which updates the nextPosition member.
Definition: MappingUtils.h:1482
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMappingIterator< Interpolator >::MultiDimMappingIterator ( MultiDimMapping< Interpolator > &  pMapping,
const Argument pos 
)
inline

Intializes the Iterator for the passed MultiDimMapping and sets its position two the passed position.

1543  :
1544  MappingIterator(), mapping(pMapping),
1545  valueIt(pMapping.entries.beginIntpl() /*pMapping.entries.findIntpl(pos.getArgValue(pMapping.myDimension))*/), //ATTENTION: pMapping.entries.findIntpl(...) results in GCC-Crash at -O2
1546  subMapping(0), subIterator(nullptr),
1547  position(pos), nextPosition()
1548  {
1549  // valueIt was not initialized with pMapping.entries.findIntpl(...), so we need the jumpTo-call
1550  valueIt.jumpTo(position.getArgValue(mapping.myDimension));
1552  if (*subMapping) {
1553  subIterator = (*subMapping)->createIterator(position);
1554  }
1556 
1558  }
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
MappingIterator()
Definition: MappingBase.h:1221
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
Argument nextPosition
The position a call to "next()" would jump to.
Definition: MappingUtils.h:1417
mapped_type_cref getArgValue(const Argument::key_type &dim) const
Returns the value for the specified dimension.
Definition: MappingBase.cc:102
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
interpolated getValue() const
Returns the interpolated value at the current position of the Iterator.
Definition: Interpolation.h:739
void jumpTo(key_cref_type pos)
Moves the iterator to the passed position.
Definition: Interpolation.h:639
void updateNextPosition()
Helper method which updates the nextPosition member.
Definition: MappingUtils.h:1482
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMappingIterator< Interpolator >::MultiDimMappingIterator ( const MultiDimMappingIterator< Interpolator > &  o)
inline
1560  :
1561  MappingIterator(o), mapping(o.mapping),
1562  valueIt(o.valueIt),
1563  subMapping(o.subMapping), subIterator(nullptr),
1564  position(o.position), nextPosition(o.nextPosition)
1565  {
1566  // valueIt was not initialized with pMapping.entries.findIntpl(...), so we need the jumpTo-call
1567  if (*subMapping) {
1568  subIterator = (*subMapping)->createIterator(position);
1569  }
1570  }
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
MappingIterator()
Definition: MappingBase.h:1221
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
Argument nextPosition
The position a call to "next()" would jump to.
Definition: MappingUtils.h:1417
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
virtual inet::physicallayer::MultiDimMappingIterator< Interpolator >::~MultiDimMappingIterator ( )
inlinevirtual

Frees the memory allocated for the sub mappings.

1576  {
1577  if (subIterator)
1578  delete subIterator;
1579  }
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411

Member Function Documentation

template<template< typename > class Interpolator>
virtual const Argument& inet::physicallayer::MultiDimMappingIterator< Interpolator >::getNextPosition ( ) const
inlineoverridevirtual

returns the next position a call to "next()" would jump to.

Constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

1694  {
1695  return nextPosition;
1696  }
Argument nextPosition
The position a call to "next()" would jump to.
Definition: MappingUtils.h:1417
template<template< typename > class Interpolator>
virtual const Argument& inet::physicallayer::MultiDimMappingIterator< Interpolator >::getPosition ( ) const
inlineoverridevirtual

Returns the current position of the iterator.

Constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

1684  {
1685  return position;
1686  }
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
template<template< typename > class Interpolator>
virtual argument_value_t inet::physicallayer::MultiDimMappingIterator< Interpolator >::getValue ( ) const
inlineoverridevirtual

Returns the value of the underlying mapping at the current position.

Has constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

1705  {
1706  if (subIterator)
1707  return subIterator->getValue();
1708  else
1709  return Argument::MappedZero;
1710  }
static const mapped_type MappedZero
Zero value of a Argument value.
Definition: MappingBase.h:427
virtual argument_value_t getValue() const =0
Returns the value of the Mapping at the current position.
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
virtual bool inet::physicallayer::MultiDimMappingIterator< Interpolator >::hasNext ( ) const
inlineoverridevirtual

Returns true if the iterator has a valid next value a call to "next()" could jump to.

Constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

1738  {
1739  return valueIt.hasNext() || (subIterator && subIterator->hasNext() && valueIt.inRange());
1740  }
virtual bool hasNext() const =0
Returns true if the iterator has a next value it can iterate to on a call to "next()".
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
bool inRange() const
Returns true if the current position of the iterator is between the position of the first and the las...
Definition: Interpolation.h:714
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
bool hasNext() const
Returns true if the a call of "next()" would increase to the position of an a valid entry of the data...
Definition: Interpolation.h:728
template<template< typename > class Interpolator>
virtual bool inet::physicallayer::MultiDimMappingIterator< Interpolator >::inRange ( ) const
inlineoverridevirtual

Returns true if the current position of the iterator is in range of the function.

This method should be used as end-condition when iterating over the function with the "next()" method.

Constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

1674  {
1675  return valueIt.inRange() && (subMapping.isInterpolated || (subIterator && subIterator->inRange()));
1676  }
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
virtual bool inRange() const =0
Returns true if the current position of the iterator is in range of the function. ...
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
bool inRange() const
Returns true if the current position of the iterator is between the position of the first and the las...
Definition: Interpolation.h:714
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
void inet::physicallayer::MultiDimMappingIterator< Interpolator >::iterateTo ( const Argument pos)
inlineoverridevirtual

Iterates to the specified position.

This method should be used if the new position is near the current position.

The new position has to be compared bigger than the current position

Has linear complexity over the number of entries between the current position and the passed position. This leads to nearly constant complexity for position close together.

Implements inet::physicallayer::ConstMappingIterator.

1618  {
1619  argument_value_cref_t argVal = pos.getArgValue(mapping.myDimension);
1620 
1621  if (argVal != valueIt.getPosition() && pos.hasArgVal(mapping.myDimension)) {
1622  valueIt.iterateTo(argVal);
1623  updateSubIterator(pos);
1624  }
1625  else {
1626  if (subIterator)
1627  subIterator->iterateTo(pos);
1628  }
1629 
1630  position.setArgValues(pos);
1632  }
virtual void iterateTo(const Argument &pos)=0
Iterates to the specified position.
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
Argument::mapped_type_cref argument_value_cref_t
Definition: MappingBase.h:722
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
void setArgValues(const Argument &o, bool ignoreUnknown=false)
Update the values of this Argument with the values of the passed Argument.
Definition: MappingBase.cc:143
void iterateTo(key_cref_type pos)
forward iterates the iterator to the passed position.
Definition: Interpolation.h:673
void updateSubIterator()
Helper method which updates the sub-iterator and sets the position of the sub-iterator to its beginni...
Definition: MappingUtils.h:1454
key_cref_type getPosition() const
Returns the current position of the iterator.
Definition: Interpolation.h:758
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
void updateNextPosition()
Helper method which updates the nextPosition member.
Definition: MappingUtils.h:1482
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
void inet::physicallayer::MultiDimMappingIterator< Interpolator >::jumpTo ( const Argument pos)
inlineoverridevirtual

Lets the iterator point to the passed position.

The passed new position can be at arbitrary places.

Has logarithmic complexity in number of dimensions and number of entries inside each dimension.

Implements inet::physicallayer::ConstMappingIterator.

1590  {
1591  argument_value_cref_t argVal = pos.getArgValue(mapping.myDimension);
1592 
1593  if (argVal != valueIt.getPosition() && pos.hasArgVal(mapping.myDimension)) {
1594  valueIt.jumpTo(argVal);
1595  updateSubIterator(pos);
1596  }
1597  else {
1598  if (subIterator)
1599  subIterator->jumpTo(pos);
1600  }
1601 
1602  position.setArgValues(pos);
1605  }
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
Argument::mapped_type_cref argument_value_cref_t
Definition: MappingBase.h:722
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
virtual void jumpTo(const Argument &pos)=0
Lets the iterator point to the passed position.
void setArgValues(const Argument &o, bool ignoreUnknown=false)
Update the values of this Argument with the values of the passed Argument.
Definition: MappingBase.cc:143
Argument nextPosition
The position a call to "next()" would jump to.
Definition: MappingUtils.h:1417
void updateSubIterator()
Helper method which updates the sub-iterator and sets the position of the sub-iterator to its beginni...
Definition: MappingUtils.h:1454
key_cref_type getPosition() const
Returns the current position of the iterator.
Definition: Interpolation.h:758
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
void jumpTo(key_cref_type pos)
Moves the iterator to the passed position.
Definition: Interpolation.h:639
void updateNextPosition()
Helper method which updates the nextPosition member.
Definition: MappingUtils.h:1482
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
virtual void inet::physicallayer::MultiDimMappingIterator< Interpolator >::jumpToBegin ( )
inlineoverridevirtual

Lets the iterator point to the begin of the function.

The beginning of the function depends is the position of the first entry in the underlying Mapping.

Constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

1721  {
1722  valueIt.jumpToBegin();
1724  if (subIterator)
1726 
1729  }
void jumpToBegin()
Moves the iterator to the first element.
Definition: Interpolation.h:653
virtual const Argument & getPosition() const =0
Returns the current position of the iterator.
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
void setArgValues(const Argument &o, bool ignoreUnknown=false)
Update the values of this Argument with the values of the passed Argument.
Definition: MappingBase.cc:143
void setArgValue(const Argument::key_type &dim, Argument::mapped_type_cref value)
Changes the value for the specified dimension.
Definition: MappingBase.cc:112
void updateSubIterator()
Helper method which updates the sub-iterator and sets the position of the sub-iterator to its beginni...
Definition: MappingUtils.h:1454
key_cref_type getPosition() const
Returns the current position of the iterator.
Definition: Interpolation.h:758
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
void updateNextPosition()
Helper method which updates the nextPosition member.
Definition: MappingUtils.h:1482
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
virtual void inet::physicallayer::MultiDimMappingIterator< Interpolator >::next ( )
inlineoverridevirtual

Iterates to the next position of the function.

The next position depends on the implementation of the Function. Calling this method will always work, but if their is no next entry to iterate to inside the underlying Mapping the actual position next jumps will be valid but without meaning. Therefore "hasNext()" should be called before calling this method.

Has constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

1647  {
1648  if (!subMapping.isInterpolated && subIterator && subIterator->hasNext()) {
1649  subIterator->next();
1650  }
1651  else {
1652  valueIt.next();
1654  }
1655 
1656  if (subIterator)
1658 
1660 
1662  }
virtual bool hasNext() const =0
Returns true if the iterator has a next value it can iterate to on a call to "next()".
virtual const Argument & getPosition() const =0
Returns the current position of the iterator.
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
void setArgValues(const Argument &o, bool ignoreUnknown=false)
Update the values of this Argument with the values of the passed Argument.
Definition: MappingBase.cc:143
virtual void next()=0
Iterates to the next position of the Mapping.
void setArgValue(const Argument::key_type &dim, Argument::mapped_type_cref value)
Changes the value for the specified dimension.
Definition: MappingBase.cc:112
void updateSubIterator()
Helper method which updates the sub-iterator and sets the position of the sub-iterator to its beginni...
Definition: MappingUtils.h:1454
key_cref_type getPosition() const
Returns the current position of the iterator.
Definition: Interpolation.h:758
void next()
Iterates to the next entry in the underlying data structure.
Definition: Interpolation.h:692
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
void updateNextPosition()
Helper method which updates the nextPosition member.
Definition: MappingUtils.h:1482
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
MultiDimMappingIterator& inet::physicallayer::MultiDimMappingIterator< Interpolator >::operator= ( const MultiDimMappingIterator< Interpolator > &  )
private

Assignment operator is not allowed.

template<template< typename > class Interpolator>
virtual void inet::physicallayer::MultiDimMappingIterator< Interpolator >::setValue ( argument_value_cref_t  value)
inlineoverridevirtual

Changes the value of the function at the current position.

Constant complexity.

Implements inet::physicallayer::MappingIterator.

Reimplemented in inet::physicallayer::FilledUpMappingIterator.

1749  {
1750  if (subMapping.isInterpolated) {
1751  valueIt.setValue(mapping.createSubSignal());
1753  }
1754  subIterator->setValue(value);
1755  }
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
void setValue(mapped_cref_type value)
: Changes (and adds if necessary) the value for the entry at the current position of the iterator to ...
Definition: Interpolation.h:817
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
void updateSubIterator()
Helper method which updates the sub-iterator and sets the position of the sub-iterator to its beginni...
Definition: MappingUtils.h:1454
virtual void setValue(argument_value_cref_t value)=0
Changes the value of the Mapping at the current position.
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
template<template< typename > class Interpolator>
void inet::physicallayer::MultiDimMappingIterator< Interpolator >::updateNextPosition ( )
inlineprotected

Helper method which updates the nextPosition member.

Called when the current position has changed.

1483  {
1484  bool intp = subMapping.isInterpolated;
1485 
1486  bool noSubIt = false;
1487  bool hasNoNext = false;
1488  if (!intp) {
1489  noSubIt = !subIterator;
1490  if (!noSubIt)
1491  hasNoNext = !subIterator->hasNext();
1492  }
1493  if (intp || noSubIt || hasNoNext) {
1494  if (valueIt.hasNext()) {
1495  ConstMappingIterator *tmp = (*valueIt.getNextValue())->createConstIterator();
1496  nextPosition.setArgValues(tmp->getPosition());
1497  delete tmp;
1498  }
1499  else {
1501  }
1503  }
1504  else {
1506  }
1507  }
virtual bool hasNext() const =0
Returns true if the iterator has a next value it can iterate to on a call to "next()".
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
const MultiDimMapping< Interpolator > & mapping
The MultiDimmapping to iterate over.
Definition: MappingUtils.h:1400
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
void setArgValues(const Argument &o, bool ignoreUnknown=false)
Update the values of this Argument with the values of the passed Argument.
Definition: MappingBase.cc:143
ConstMappingIterator()
Definition: MappingBase.h:725
virtual const Argument & getNextPosition() const =0
Returns the position the next call to "next()" of this Iterator would iterate to. ...
Argument nextPosition
The position a call to "next()" would jump to.
Definition: MappingUtils.h:1417
void setArgValue(const Argument::key_type &dim, Argument::mapped_type_cref value)
Changes the value for the specified dimension.
Definition: MappingBase.cc:112
interpolated getNextValue() const
Definition: Interpolation.h:744
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
key_type getNextPosition()
Definition: Interpolation.h:702
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
bool hasNext() const
Returns true if the a call of "next()" would increase to the position of an a valid entry of the data...
Definition: Interpolation.h:728
template<template< typename > class Interpolator>
void inet::physicallayer::MultiDimMappingIterator< Interpolator >::updateSubIterator ( const Argument pos)
inlineprotected

Helper method which updates the sub-iterator for the passed position.

Called when the position of of the iterator inside the dimension this Iterator represents has changed.

1429  {
1430  interpolated subM = valueIt.getValue();
1431  if (subM != subMapping) {
1432  if (subIterator)
1433  delete subIterator;
1434 
1435  subMapping = subM;
1436  if (*subMapping)
1437  subIterator = (*subMapping)->createIterator(pos);
1438  else
1439  subIterator = 0;
1440  }
1441  else {
1442  if (subIterator)
1443  subIterator->jumpTo(pos);
1444  }
1445  }
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
virtual void jumpTo(const Argument &pos)=0
Lets the iterator point to the passed position.
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
interpolated getValue() const
Returns the interpolated value at the current position of the Iterator.
Definition: Interpolation.h:739
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
interpolator_map_type::interpolated interpolated
Definition: MappingUtils.h:1395
template<template< typename > class Interpolator>
void inet::physicallayer::MultiDimMappingIterator< Interpolator >::updateSubIterator ( )
inlineprotected

Helper method which updates the sub-iterator and sets the position of the sub-iterator to its beginning.

Called when the position of of the iterator inside the dimension this Iterator represents has changed.

1455  {
1456  interpolated subM = valueIt.getValue();
1457  if (subM != subMapping) {
1458  if (subIterator)
1459  delete subIterator;
1460 
1461  subMapping = subM;
1462  if (*subMapping) {
1463  if (subMapping.isInterpolated)
1464  subIterator = (*subMapping)->createIterator(position);
1465  else
1466  subIterator = (*subMapping)->createIterator();
1467  }
1468  else
1469  subIterator = 0;
1470  }
1471  else {
1472  if (subIterator)
1474  }
1475  }
Argument position
The current position in every Dimension of this Iterator.
Definition: MappingUtils.h:1414
interpolated subMapping
The sub-mapping of the sub-mapping map at the current position.
Definition: MappingUtils.h:1407
virtual void jumpToBegin()=0
Lets the iterator point to the begin of the mapping.
iterator valueIt
Iterator storing the current position inside the underlying Mappings sub-mapping map.
Definition: MappingUtils.h:1404
interpolated getValue() const
Returns the interpolated value at the current position of the Iterator.
Definition: Interpolation.h:739
MappingIterator * subIterator
An iterator for the sub-mapping which points two the current position in the next dimensions...
Definition: MappingUtils.h:1411
interpolator_map_type::interpolated interpolated
Definition: MappingUtils.h:1395

Member Data Documentation

template<template< typename > class Interpolator>
const MultiDimMapping<Interpolator>& inet::physicallayer::MultiDimMappingIterator< Interpolator >::mapping
protected

The MultiDimmapping to iterate over.

template<template< typename > class Interpolator>
Argument inet::physicallayer::MultiDimMappingIterator< Interpolator >::nextPosition
protected

The position a call to "next()" would jump to.

template<template< typename > class Interpolator>
Argument inet::physicallayer::MultiDimMappingIterator< Interpolator >::position
protected

The current position in every Dimension of this Iterator.

template<template< typename > class Interpolator>
MappingIterator* inet::physicallayer::MultiDimMappingIterator< Interpolator >::subIterator
protected

An iterator for the sub-mapping which points two the current position in the next dimensions.

template<template< typename > class Interpolator>
interpolated inet::physicallayer::MultiDimMappingIterator< Interpolator >::subMapping
protected

The sub-mapping of the sub-mapping map at the current position.

template<template< typename > class Interpolator>
iterator inet::physicallayer::MultiDimMappingIterator< Interpolator >::valueIt
protected

Iterator storing the current position inside the underlying Mappings sub-mapping map.


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