INET Framework for OMNeT++/OMNEST
inet::physicallayer::InterpolateableIterator< TInterpolator > Class Template Reference

Provides an interpolateable iterator for any Container which maps from keys to values which is able to change the underlying Container. More...

#include <Interpolation.h>

Inheritance diagram for inet::physicallayer::InterpolateableIterator< TInterpolator >:
inet::physicallayer::ConstInterpolateableIterator< TInterpolator, TInterpolator::iterator >

Public Member Functions

 InterpolateableIterator (container_type &cont, const interpolator_type &intpl)
 
virtual ~InterpolateableIterator ()
 
void setValue (mapped_cref_type value)
 : Changes (and adds if necessary) the value for the entry at the current position of the iterator to the passed value More...
 
- Public Member Functions inherited from inet::physicallayer::ConstInterpolateableIterator< TInterpolator, TInterpolator::iterator >
 ConstInterpolateableIterator (const used_iterator &first, const used_iterator &last, const interpolator_type &intpl)
 Initializes the iterator with the passed Iterators as boundaries. More...
 
virtual ~ConstInterpolateableIterator ()
 
bool operator== (const ConstInterpolateableIterator &other)
 
void jumpTo (key_cref_type pos)
 Moves the iterator to the passed position. More...
 
void jumpToBegin ()
 Moves the iterator to the first element. More...
 
void iterateTo (key_cref_type pos)
 forward iterates the iterator to the passed position. More...
 
void next ()
 Iterates to the next entry in the underlying data structure. More...
 
key_type getNextPosition ()
 
bool inRange () const
 Returns true if the current position of the iterator is between the position of the first and the last entry of the data structure. More...
 
bool hasNext () const
 Returns true if the a call of "next()" would increase to the position of an a valid entry of the data structure. More...
 
interpolated getValue () const
 Returns the interpolated value at the current position of the Iterator. More...
 
interpolated getNextValue () const
 
key_cref_type getPosition () const
 Returns the current position of the iterator. More...
 
const interpolator_typegetInterpolator () const
 

Protected Types

typedef ConstInterpolateableIterator< TInterpolator, typename TInterpolator::iterator > base_class_type
 
typedef base_class_type::container_type container_type
 
typedef container_type::const_iterator const_iterator
 
typedef container_type::iterator iterator
 
typedef base_class_type::interpolator_type interpolator_type
 
typedef base_class_type::key_type key_type
 
typedef base_class_type::key_cref_type key_cref_type
 
typedef base_class_type::mapped_type mapped_type
 
typedef base_class_type::mapped_cref_type mapped_cref_type
 
typedef container_type::value_type pair_type
 
typedef base_class_type::comparator_type comparator_type
 
typedef interpolator_type::interpolated interpolated
 typedef for the returned Interpolated value of this class. More...
 

Protected Attributes

container_typecont
 
- Protected Attributes inherited from inet::physicallayer::ConstInterpolateableIterator< TInterpolator, TInterpolator::iterator >
used_iterator first
 
used_iterator last
 
used_iterator right
 
key_type position
 
const interpolator_typeinterpolate
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::ConstInterpolateableIterator< TInterpolator, TInterpolator::iterator >
typedef TInterpolator interpolator_type
 
typedef interpolator_type::container_type container_type
 
typedef interpolator_type::key_type key_type
 
typedef interpolator_type::key_cref_type key_cref_type
 
typedef interpolator_type::mapped_type mapped_type
 
typedef interpolator_type::mapped_cref_type mapped_cref_type
 
typedef interpolator_type::pair_type pair_type
 
typedef interpolator_type::iterator iterator
 
typedef interpolator_type::const_iterator const_iterator
 
typedef interpolator_type::comparator_type comparator_type
 
typedef TInterpolator::iterator used_iterator
 
typedef interpolator_type::interpolated interpolated
 typedef for the returned Interpolated value of this class. More...
 

Detailed Description

template<typename TInterpolator>
class inet::physicallayer::InterpolateableIterator< TInterpolator >

Provides an interpolateable iterator for any Container which maps from keys to values which is able to change the underlying Container.

The underlying Container has to provide the following things:

  • a Member "value_type" which defines the type of the Key-Value-pairs
  • a Member "iterator" which defines the type of the iterator
  • an "insert"-method with the following Syntax: Iterator insert(Iterator pos, Container::value_type newEntry) which returns an iterator pointing to the newly inserted element

See ConstInterpolateableIterator for more details.

Author
Karl Wessel

Member Typedef Documentation

template<typename TInterpolator >
typedef ConstInterpolateableIterator<TInterpolator, typename TInterpolator::iterator> inet::physicallayer::InterpolateableIterator< TInterpolator >::base_class_type
protected
template<typename TInterpolator >
typedef base_class_type::comparator_type inet::physicallayer::InterpolateableIterator< TInterpolator >::comparator_type
protected
template<typename TInterpolator >
typedef container_type::const_iterator inet::physicallayer::InterpolateableIterator< TInterpolator >::const_iterator
protected
template<typename TInterpolator >
typedef base_class_type::container_type inet::physicallayer::InterpolateableIterator< TInterpolator >::container_type
protected
template<typename TInterpolator >
typedef interpolator_type::interpolated inet::physicallayer::InterpolateableIterator< TInterpolator >::interpolated
protected

typedef for the returned Interpolated value of this class.

template<typename TInterpolator >
typedef base_class_type::interpolator_type inet::physicallayer::InterpolateableIterator< TInterpolator >::interpolator_type
protected
template<typename TInterpolator >
typedef container_type::iterator inet::physicallayer::InterpolateableIterator< TInterpolator >::iterator
protected
template<typename TInterpolator >
typedef base_class_type::key_cref_type inet::physicallayer::InterpolateableIterator< TInterpolator >::key_cref_type
protected
template<typename TInterpolator >
typedef base_class_type::key_type inet::physicallayer::InterpolateableIterator< TInterpolator >::key_type
protected
template<typename TInterpolator >
typedef base_class_type::mapped_cref_type inet::physicallayer::InterpolateableIterator< TInterpolator >::mapped_cref_type
protected
template<typename TInterpolator >
typedef base_class_type::mapped_type inet::physicallayer::InterpolateableIterator< TInterpolator >::mapped_type
protected
template<typename TInterpolator >
typedef container_type::value_type inet::physicallayer::InterpolateableIterator< TInterpolator >::pair_type
protected

Constructor & Destructor Documentation

template<typename TInterpolator >
inet::physicallayer::InterpolateableIterator< TInterpolator >::InterpolateableIterator ( container_type cont,
const interpolator_type intpl 
)
inline
809  :
810  base_class_type(cont.begin(), cont.end(), intpl), cont(cont) {}
container_type & cont
Definition: Interpolation.h:806
ConstInterpolateableIterator< TInterpolator, typename TInterpolator::iterator > base_class_type
Definition: Interpolation.h:790
template<typename TInterpolator >
virtual inet::physicallayer::InterpolateableIterator< TInterpolator >::~InterpolateableIterator ( )
inlinevirtual
812 {}

Member Function Documentation

template<typename TInterpolator >
void inet::physicallayer::InterpolateableIterator< TInterpolator >::setValue ( mapped_cref_type  value)
inline

: Changes (and adds if necessary) the value for the entry at the current position of the iterator to the passed value

Referenced by inet::physicallayer::TimeMappingIterator< Interpolator >::setValue(), inet::physicallayer::FrequencyMappingIterator< Interpolator >::setValue(), and inet::physicallayer::MultiDimMappingIterator< Linear >::setValue().

818  {
819  //container is empty or position is smaller first entry
820  if (this->right == this->first) {
821  //insert new entry before first entry and store new entry as new first
822  this->first = cont.insert(this->first, std::make_pair(this->position, value));
823  }
824  else {
825  iterator left = this->right;
826  --left;
827  if (left->first == this->position) {
828  left->second = value;
829  }
830  else {
831  cont.insert(this->right, std::make_pair(this->position, value));
832  }
833  }
834  }
container_type::iterator iterator
Definition: Interpolation.h:793
container_type & cont
Definition: Interpolation.h:806

Member Data Documentation

template<typename TInterpolator >
container_type& inet::physicallayer::InterpolateableIterator< TInterpolator >::cont
protected

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