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

Provides an implementation of the MappingIterator- Interface which is able to iterate over FrequencyMappings. More...

#include <MappingUtils.h>

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

Public Member Functions

 FrequencyMappingIterator (const iterator &it)
 Initializes the Iterator to use the passed InterpolateableMapIterator. More...
 
 FrequencyMappingIterator (const FrequencyMappingIterator< Interpolator > &o)
 
virtual ~FrequencyMappingIterator ()
 
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 mapped_type getValue () const override
 Returns the value of the function at the current position. More...
 
virtual void jumpToBegin () override
 Lets the iterator point to the begin of the mapping. More...
 
virtual bool hasNext () const override
 Returns true if the iterator has a next value inside its range a call to "next()" can 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 ()
 
virtual void setValue (argument_value_cref_t value)=0
 Changes the value of the Mapping at the current position. More...
 
- 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, argument_value_t > > > interpolator_map_type
 The templated InterpolateableMap the underlying Mapping uses std::map as storage type. More...
 
typedef interpolator_map_type::interpolator_type interpolator_type
 
typedef interpolator_map_type::mapped_type mapped_type
 
typedef interpolator_map_type::iterator_intpl iterator
 
typedef interpolator_map_type::const_iterator_intpl const_iterator
 

Protected Member Functions

void updateNextPos ()
 

Protected Attributes

iterator valueIt
 Stores the current position iterator inside the Mapping. More...
 
Argument position
 Stores the current position of the iterator. More...
 
Argument nextPosition
 Stores the next position a call of "next()" would jump to. More...
 
bool isStepMapping
 Stores if this mapping represents a step function. More...
 
bool atPreStep
 

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::FrequencyMappingIterator< Interpolator >

Provides an implementation of the MappingIterator- Interface which is able to iterate over FrequencyMappings.

Author
Karl Wessel

Member Typedef Documentation

template<template< typename > class Interpolator>
typedef interpolator_map_type::const_iterator_intpl inet::physicallayer::FrequencyMappingIterator< Interpolator >::const_iterator
protected
template<template< typename > class Interpolator>
typedef InterpolateableMap<Interpolator<std::map<argument_value_t, argument_value_t> > > inet::physicallayer::FrequencyMappingIterator< 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::interpolator_type inet::physicallayer::FrequencyMappingIterator< Interpolator >::interpolator_type
protected
template<template< typename > class Interpolator>
typedef interpolator_map_type::iterator_intpl inet::physicallayer::FrequencyMappingIterator< Interpolator >::iterator
protected
template<template< typename > class Interpolator>
typedef interpolator_map_type::mapped_type inet::physicallayer::FrequencyMappingIterator< Interpolator >::mapped_type
protected

Constructor & Destructor Documentation

template<template< typename > class Interpolator>
inet::physicallayer::FrequencyMappingIterator< Interpolator >::FrequencyMappingIterator ( const iterator it)
inline

Initializes the Iterator to use the passed InterpolateableMapIterator.

491  : MappingIterator()
492  , valueIt(it)
493  , position()
494  , nextPosition()
495  , isStepMapping(it.getInterpolator().isStepping())
496  , atPreStep(false)
497  {
498  interpolator_type UsedInterpolator;
499 
500  isStepMapping = UsedInterpolator.isStepping();
502  updateNextPos();
503  }
interpolator_map_type::interpolator_type interpolator_type
Definition: MappingUtils.h:449
bool atPreStep
Definition: MappingUtils.h:473
MappingIterator()
Definition: MappingBase.h:1221
bool isStepMapping
Stores if this mapping represents a step function.
Definition: MappingUtils.h:471
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
static const Dimension frequency
Shortcut to the frequency Dimension, same as &#39;Dimension("frequency")&#39;, but spares the parsing of a st...
Definition: MappingBase.h:68
Argument position
Stores the current position of the iterator.
Definition: MappingUtils.h:458
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
Argument nextPosition
Stores the next position a call of "next()" would jump to.
Definition: MappingUtils.h:461
void updateNextPos()
Definition: MappingUtils.h:476
template<template< typename > class Interpolator>
inet::physicallayer::FrequencyMappingIterator< Interpolator >::FrequencyMappingIterator ( const FrequencyMappingIterator< Interpolator > &  o)
inline
506  : MappingIterator(o)
507  , valueIt(o.valueIt)
508  , position(o.position)
509  , nextPosition(o.nextPosition)
510  , isStepMapping(o.isStepMapping)
511  , atPreStep(o.atPreStep)
512  {}
bool atPreStep
Definition: MappingUtils.h:473
MappingIterator()
Definition: MappingBase.h:1221
bool isStepMapping
Stores if this mapping represents a step function.
Definition: MappingUtils.h:471
Argument position
Stores the current position of the iterator.
Definition: MappingUtils.h:458
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
Argument nextPosition
Stores the next position a call of "next()" would jump to.
Definition: MappingUtils.h:461
template<template< typename > class Interpolator>
virtual inet::physicallayer::FrequencyMappingIterator< Interpolator >::~FrequencyMappingIterator ( )
inlinevirtual
514 {}

Member Function Documentation

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

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

This method has constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

604  {
605  return nextPosition;
606  }
Argument nextPosition
Stores the next position a call of "next()" would jump to.
Definition: MappingUtils.h:461
template<template< typename > class Interpolator>
virtual const Argument& inet::physicallayer::FrequencyMappingIterator< Interpolator >::getPosition ( ) const
inlineoverridevirtual

Returns the current position of the iterator.

This method has constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

594  {
595  return position;
596  }
Argument position
Stores the current position of the iterator.
Definition: MappingUtils.h:458
template<template< typename > class Interpolator>
virtual mapped_type inet::physicallayer::FrequencyMappingIterator< Interpolator >::getValue ( ) const
inlineoverridevirtual

Returns the value of the function at the current position.

This method has constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

615  {
616  return *valueIt.getValue();
617  }
interpolated getValue() const
Returns the interpolated value at the current position of the Iterator.
Definition: Interpolation.h:739
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
template<template< typename > class Interpolator>
virtual bool inet::physicallayer::FrequencyMappingIterator< Interpolator >::hasNext ( ) const
inlineoverridevirtual

Returns true if the iterator has a next value inside its range a call to "next()" can jump to.

Constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

640  {
641  return valueIt.hasNext();
642  }
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
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::FrequencyMappingIterator< 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.

THis method has constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

584  {
585  return valueIt.inRange();
586  }
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
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
template<template< typename > class Interpolator>
void inet::physicallayer::FrequencyMappingIterator< 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 passed position should compared bigger than the current position.

This method has linear complexity over the number of key-entries between the current position and the passed position. So if the passed position is near the current position the complexity is nearly constant.

Implements inet::physicallayer::ConstMappingIterator.

544  {
545  atPreStep = false;
546  valueIt.iterateTo(pos.getArgValue(Dimension::frequency));
549  updateNextPos();
550  }
bool atPreStep
Definition: MappingUtils.h:473
void iterateTo(key_cref_type pos)
forward iterates the iterator to the passed position.
Definition: Interpolation.h:673
void setArgValue(const Argument::key_type &dim, Argument::mapped_type_cref value)
Changes the value for the specified dimension.
Definition: MappingBase.cc:112
static const Dimension frequency
Shortcut to the frequency Dimension, same as &#39;Dimension("frequency")&#39;, but spares the parsing of a st...
Definition: MappingBase.h:68
Argument position
Stores the current position of the iterator.
Definition: MappingUtils.h:458
key_type getNextPosition()
Definition: Interpolation.h:702
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
Argument nextPosition
Stores the next position a call of "next()" would jump to.
Definition: MappingUtils.h:461
void updateNextPos()
Definition: MappingUtils.h:476
template<template< typename > class Interpolator>
void inet::physicallayer::FrequencyMappingIterator< Interpolator >::jumpTo ( const Argument pos)
inlineoverridevirtual

Lets the iterator point to the passed position.

The passed new position can be at arbitrary places.

This method has logarithmic complexity.

Implements inet::physicallayer::ConstMappingIterator.

524  {
525  atPreStep = false;
526  valueIt.jumpTo(pos.getArgValue(Dimension::frequency));
529  updateNextPos();
530  }
bool atPreStep
Definition: MappingUtils.h:473
void setArgValue(const Argument::key_type &dim, Argument::mapped_type_cref value)
Changes the value for the specified dimension.
Definition: MappingBase.cc:112
static const Dimension frequency
Shortcut to the frequency Dimension, same as &#39;Dimension("frequency")&#39;, but spares the parsing of a st...
Definition: MappingBase.h:68
Argument position
Stores the current position of the iterator.
Definition: MappingUtils.h:458
key_type getNextPosition()
Definition: Interpolation.h:702
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
Argument nextPosition
Stores the next position a call of "next()" would jump to.
Definition: MappingUtils.h:461
void updateNextPos()
Definition: MappingUtils.h:476
void jumpTo(key_cref_type pos)
Moves the iterator to the passed position.
Definition: Interpolation.h:639
template<template< typename > class Interpolator>
virtual void inet::physicallayer::FrequencyMappingIterator< Interpolator >::jumpToBegin ( )
inlineoverridevirtual

Lets the iterator point to the begin of the mapping.

The beginning of the mapping is the smallest key entry in the InterpolateableMap.

Constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

628  {
631  }
void jumpToBegin()
Moves the iterator to the first element.
Definition: Interpolation.h:653
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
static const Dimension frequency
Shortcut to the frequency Dimension, same as &#39;Dimension("frequency")&#39;, but spares the parsing of a st...
Definition: MappingBase.h:68
Argument position
Stores the current position of the iterator.
Definition: MappingUtils.h:458
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
template<template< typename > class Interpolator>
virtual void inet::physicallayer::FrequencyMappingIterator< Interpolator >::next ( )
inlineoverridevirtual

Iterates to the next position of the function.

The next position is the next bigger key entry of the InterpoalteableMap.

This method has constant complexity.

Implements inet::physicallayer::ConstMappingIterator.

561  {
562  if (isStepMapping && !atPreStep) {
564  atPreStep = true;
565  }
566  else {
567  valueIt.next();
568  atPreStep = false;
569  }
571  updateNextPos();
572  }
bool atPreStep
Definition: MappingUtils.h:473
bool isStepMapping
Stores if this mapping represents a step function.
Definition: MappingUtils.h:471
void iterateTo(key_cref_type pos)
forward iterates the iterator to the passed position.
Definition: Interpolation.h:673
mapped_type_cref getArgValue(const Argument::key_type &dim) const
Returns the value for the specified dimension.
Definition: MappingBase.cc:102
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
void next()
Iterates to the next entry in the underlying data structure.
Definition: Interpolation.h:692
static const Dimension frequency
Shortcut to the frequency Dimension, same as &#39;Dimension("frequency")&#39;, but spares the parsing of a st...
Definition: MappingBase.h:68
Argument position
Stores the current position of the iterator.
Definition: MappingUtils.h:458
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
Argument nextPosition
Stores the next position a call of "next()" would jump to.
Definition: MappingUtils.h:461
void updateNextPos()
Definition: MappingUtils.h:476
template<template< typename > class Interpolator>
virtual void inet::physicallayer::FrequencyMappingIterator< Interpolator >::setValue ( argument_value_cref_t  value)
inlineoverridevirtual

Changes the value of the function at the current position.

This method has constant complexity.

651  {
652  valueIt.setValue(value);
653  }
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
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
template<template< typename > class Interpolator>
void inet::physicallayer::FrequencyMappingIterator< Interpolator >::updateNextPos ( )
inlineprotected
477  {
479  if (isStepMapping && !atPreStep) {
480  value = nexttoward(value, 0);
481  }
483  }
bool atPreStep
Definition: MappingUtils.h:473
bool isStepMapping
Stores if this mapping represents a step function.
Definition: MappingUtils.h:471
void setArgValue(const Argument::key_type &dim, Argument::mapped_type_cref value)
Changes the value for the specified dimension.
Definition: MappingBase.cc:112
Argument::mapped_type argument_value_t
Definition: MappingBase.h:721
static const Dimension frequency
Shortcut to the frequency Dimension, same as &#39;Dimension("frequency")&#39;, but spares the parsing of a st...
Definition: MappingBase.h:68
key_type getNextPosition()
Definition: Interpolation.h:702
iterator valueIt
Stores the current position iterator inside the Mapping.
Definition: MappingUtils.h:455
Argument nextPosition
Stores the next position a call of "next()" would jump to.
Definition: MappingUtils.h:461

Member Data Documentation

template<template< typename > class Interpolator>
bool inet::physicallayer::FrequencyMappingIterator< Interpolator >::atPreStep
protected
template<template< typename > class Interpolator>
bool inet::physicallayer::FrequencyMappingIterator< Interpolator >::isStepMapping
protected

Stores if this mapping represents a step function.

Assures that the steps are considered when iterating the mapping by adding a second key-entry as short as possible before every key entry set by the user. The additional key-entry defines the value the mapping has just before the key entry the user added.

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

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

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

Stores the current position of the iterator.

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

Stores the current position iterator inside the Mapping.


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