Provides an implementation of the MappingIterator- Interface which is able to iterate over TimeMappings. More...
#include <MappingUtils.h>
Inherits MappingIterator.
Public Member Functions | |
TimeMappingIterator (IteratorType it, bool isStepMapping) | |
Initializes the Iterator to use the passed InterpolateableMapIterator. | |
void | jumpTo (const Argument &pos) |
Lets the iterator point to the passed position. | |
void | iterateTo (const Argument &pos) |
Iterates to the specified position. This method should be used if the new position is near the current position. | |
virtual void | next () |
Iterates to the next position of the function. | |
virtual bool | inRange () const |
Returns true if the current position of the iterator is in range of the function. | |
virtual const Argument & | getPosition () const |
Returns the current position of the iterator. | |
virtual const Argument & | getNextPosition () const |
Returns the next position a call to "next()" would jump to. | |
virtual double | getValue () const |
Returns the value of the function at the current position. | |
virtual void | jumpToBegin () |
Lets the iterator point to the begin of the mapping. | |
virtual bool | hasNext () const |
Returns true if the iterator has a next value inside its range a call to "next()" can jump to. | |
virtual void | setValue (double value) |
Changes the value of the function at the current position. | |
Protected Types | |
typedef std::map< simtime_t, double > | MapType |
The std::map the InterpolateableMap is based on. | |
typedef InterpolateableMap < simtime_t, double, Interpolator< simtime_t, double, MapType::value_type, MapType::const_iterator > >::intpl_iterator | IteratorType |
The templated InterpolateableMap the underlying Mapping uses. | |
Protected Member Functions | |
void | updateNextPos () |
Protected Attributes | |
IteratorType | valueIt |
Stores the current position iterator inside the Mapping. | |
Argument | position |
Stores the current position of the iterator. | |
Argument | nextPosition |
Stores the next position a call of "next()" would jump to. | |
bool | isStepMapping |
bool | atPreStep |
Provides an implementation of the MappingIterator- Interface which is able to iterate over TimeMappings.
Definition at line 97 of file MappingUtils.h.
virtual const Argument& TimeMappingIterator< Interpolator >::getNextPosition | ( | ) | const [inline, virtual] |
Returns the next position a call to "next()" would jump to.
This method has constant complexity.
Implements ConstMappingIterator.
Definition at line 219 of file MappingUtils.h.
References TimeMappingIterator< Interpolator >::nextPosition.
{ return nextPosition; }
virtual const Argument& TimeMappingIterator< Interpolator >::getPosition | ( | ) | const [inline, virtual] |
Returns the current position of the iterator.
This method has constant complexity.
Implements ConstMappingIterator.
Definition at line 210 of file MappingUtils.h.
References TimeMappingIterator< Interpolator >::position.
{ return position; }
virtual double TimeMappingIterator< Interpolator >::getValue | ( | ) | const [inline, virtual] |
Returns the value of the function at the current position.
This method has constant complexity.
Implements ConstMappingIterator.
Definition at line 229 of file MappingUtils.h.
References TimeMappingIterator< Interpolator >::valueIt.
{ return *valueIt.getValue(); }
virtual bool TimeMappingIterator< Interpolator >::hasNext | ( | ) | const [inline, virtual] |
Returns true if the iterator has a next value inside its range a call to "next()" can jump to.
Constant complexity.
Implements ConstMappingIterator.
Definition at line 252 of file MappingUtils.h.
References TimeMappingIterator< Interpolator >::valueIt.
{ return valueIt.hasNext(); }
virtual bool TimeMappingIterator< Interpolator >::inRange | ( | ) | const [inline, virtual] |
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 ConstMappingIterator.
Definition at line 201 of file MappingUtils.h.
References TimeMappingIterator< Interpolator >::valueIt.
{ return valueIt.inRange(); }
void TimeMappingIterator< Interpolator >::iterateTo | ( | const Argument & | pos | ) | [inline, virtual] |
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 ConstMappingIterator.
Definition at line 165 of file MappingUtils.h.
References Argument::getTime(), TimeMappingIterator< Interpolator >::nextPosition, TimeMappingIterator< Interpolator >::position, Argument::setTime(), and TimeMappingIterator< Interpolator >::valueIt.
void TimeMappingIterator< Interpolator >::jumpTo | ( | const Argument & | pos | ) | [inline, virtual] |
Lets the iterator point to the passed position.
The passed new position can be at arbitrary places.
This method has logarithmic complexity.
Implements ConstMappingIterator.
Definition at line 147 of file MappingUtils.h.
References Argument::getTime(), TimeMappingIterator< Interpolator >::nextPosition, TimeMappingIterator< Interpolator >::position, Argument::setTime(), and TimeMappingIterator< Interpolator >::valueIt.
virtual void TimeMappingIterator< Interpolator >::jumpToBegin | ( | ) | [inline, virtual] |
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 ConstMappingIterator.
Definition at line 241 of file MappingUtils.h.
References TimeMappingIterator< Interpolator >::position, Argument::setTime(), and TimeMappingIterator< Interpolator >::valueIt.
virtual void TimeMappingIterator< Interpolator >::next | ( | ) | [inline, virtual] |
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 ConstMappingIterator.
Definition at line 180 of file MappingUtils.h.
References Argument::getTime(), TimeMappingIterator< Interpolator >::nextPosition, TimeMappingIterator< Interpolator >::position, Argument::setTime(), and TimeMappingIterator< Interpolator >::valueIt.
virtual void TimeMappingIterator< Interpolator >::setValue | ( | double | value | ) | [inline, virtual] |
Changes the value of the function at the current position.
THis method has constant complexity.
Implements MappingIterator.
Definition at line 262 of file MappingUtils.h.
References TimeMappingIterator< Interpolator >::valueIt.
{ valueIt.setValue(value); }