INET Framework for OMNeT++/OMNEST
|
Implementation of the MappingIterator-interface which is able to iterate over every value in a MultiDimMapping. More...
#include <MappingUtils.h>
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 Argument & | getPosition () const override |
Returns the current position of the iterator. More... | |
virtual const Argument & | getNextPosition () 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... | |
ConstMappingIterator & | operator= (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... | |
MappingIterator * | subIterator |
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 | |
MultiDimMappingIterator & | operator= (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 |
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.
|
protected |
|
protected |
|
protected |
The templated InterpolateableMap the underlying Mapping uses std::map as storage type.
|
protected |
|
inline |
Initializes the Iterator for the passed MultiDimMapping and sets its position two the first entry of the passed MultiDimMapping.
|
inline |
Intializes the Iterator for the passed MultiDimMapping and sets its position two the passed position.
|
inline |
|
inlinevirtual |
Frees the memory allocated for the sub mappings.
|
inlineoverridevirtual |
returns the next position a call to "next()" would jump to.
Constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
|
inlineoverridevirtual |
Returns the current position of the iterator.
Constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
|
inlineoverridevirtual |
Returns the value of the underlying mapping at the current position.
Has constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
|
inlineoverridevirtual |
Returns true if the iterator has a valid next value a call to "next()" could jump to.
Constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
|
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.
|
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.
|
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.
|
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.
|
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.
|
private |
Assignment operator is not allowed.
|
inlineoverridevirtual |
Changes the value of the function at the current position.
Constant complexity.
Implements inet::physicallayer::MappingIterator.
Reimplemented in inet::physicallayer::FilledUpMappingIterator.
|
inlineprotected |
Helper method which updates the nextPosition member.
Called when the current position has changed.
|
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.
|
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.
|
protected |
The MultiDimmapping to iterate over.
|
protected |
The position a call to "next()" would jump to.
|
protected |
The current position in every Dimension of this Iterator.
|
protected |
An iterator for the sub-mapping which points two the current position in the next dimensions.
|
protected |
The sub-mapping of the sub-mapping map at the current position.
|
protected |
Iterator storing the current position inside the underlying Mappings sub-mapping map.