INET Framework for OMNeT++/OMNEST
|
A fully working ConstIterator-implementation usable with almost every ConstMapping. More...
#include <MappingBase.h>
Public Member Functions | |
SimpleConstMappingIterator (const ConstMapping *mapping, const SimpleConstMappingIterator::KeyEntrySet *keyEntries, const Argument &start) | |
Initializes the ConstIterator for the passed ConstMapping, with the passed key entries to iterate over and the passed position as start. More... | |
SimpleConstMappingIterator (const ConstMapping *mapping, const SimpleConstMappingIterator::KeyEntrySet *keyEntries) | |
Initializes the ConstIterator for the passed ConstMapping, with the passed key entries to iterate over. More... | |
virtual const Argument & | getNextPosition () const override |
Returns the next position a call to "next()" would iterate to. More... | |
virtual void | jumpTo (const Argument &pos) override |
Lets the iterator point to the passed position. More... | |
virtual void | jumpToBegin () override |
Lets the iterator point to the first "position of interest" of the underlying mapping. More... | |
virtual void | iterateTo (const Argument &pos) override |
Increases the position of the iterator to the passed position. More... | |
virtual void | next () override |
Iterates to the next "point of interest" of the Mapping. More... | |
virtual bool | inRange () const override |
Returns true if the current position of the iterator is equal or bigger than the first point of interest and lower or equal than the last point of interest. More... | |
virtual bool | hasNext () const override |
Returns true if there is a next position a call to "next()" can iterate to. More... | |
virtual const Argument & | getPosition () const override |
Returns the current position of the iterator. More... | |
virtual argument_value_t | getValue () const override |
Returns the value of the underlying mapping at the current position of the iterator. More... | |
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 std::set< Argument > | KeyEntrySet |
Type for a set of Arguments defining key entries. More... | |
typedef KeyEntrySet::value_type | KeyEntryType |
Type of a key entries item. More... | |
Protected Attributes | |
const ConstMapping *const | mapping |
The underlying ConstMapping to iterate over. More... | |
const DimensionSet & | dimensions |
The dimensions of the underlying ConstMapping. More... | |
KeyEntryType | position |
The current position of the iterator. More... | |
const KeyEntrySet * | keyEntries |
A pointer to a set of Arguments defining the positions to iterate over. More... | |
KeyEntrySet::const_iterator | nextEntry |
An iterator over the key entry set which defines the next bigger entry of the current position. More... | |
Private Member Functions | |
SimpleConstMappingIterator (const SimpleConstMappingIterator &) | |
Copy constructor is not allowed. More... | |
SimpleConstMappingIterator & | operator= (const SimpleConstMappingIterator &) |
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 |
A fully working ConstIterator-implementation usable with almost every ConstMapping.
Although this ConstIterator would work with almost any ConstMapping it should only be used for ConstMappings whose "getValue()"-method has constant complexity. This is because the iterator just calls the "getValue()"-method of the underlying ConstMapping on every call of its own "getValue()"-method.
The underlying ConstMapping has to provide a set of key-entries (Arguments) to the iterator to tell it the positions it should iterate over.
|
protected |
Type for a set of Arguments defining key entries.
|
protected |
Type of a key entries item.
|
private |
Copy constructor is not allowed.
inet::physicallayer::SimpleConstMappingIterator::SimpleConstMappingIterator | ( | const ConstMapping * | mapping, |
const SimpleConstMappingIterator::KeyEntrySet * | keyEntries, | ||
const Argument & | start | ||
) |
Initializes the ConstIterator for the passed ConstMapping, with the passed key entries to iterate over and the passed position as start.
Note: The pointer to the key entries has to be valid as long as the iterator exists.
inet::physicallayer::SimpleConstMappingIterator::SimpleConstMappingIterator | ( | const ConstMapping * | mapping, |
const SimpleConstMappingIterator::KeyEntrySet * | keyEntries | ||
) |
Initializes the ConstIterator for the passed ConstMapping, with the passed key entries to iterate over.
Note: The pointer to the key entries has to be valid as long as the iterator exists.
|
inlineoverridevirtual |
Returns the next position a call to "next()" would iterate to.
This method has constant complexity.
Throws an NoNextIteratorException if there is no next point of interest.
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 of the iterator.
This method has the same complexity as the "getValue()" method of the underlying mapping.
Implements inet::physicallayer::ConstMappingIterator.
|
inlineoverridevirtual |
Returns true if there is a next position a call to "next()" can iterate to.
Has constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
|
inlineoverridevirtual |
Returns true if the current position of the iterator is equal or bigger than the first point of interest and lower or equal than the last point of interest.
Has constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
|
inlineoverridevirtual |
Increases the position of the iterator to the passed position.
The passed position has to be compared greater than the previous position.
This method has constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
|
inlineoverridevirtual |
Lets the iterator point to the passed position.
This method has logarithmic complexity (over the number of key entries).
Implements inet::physicallayer::ConstMappingIterator.
|
inlineoverridevirtual |
Lets the iterator point to the first "position of interest" of the underlying mapping.
This method has constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
Referenced by SimpleConstMappingIterator().
|
inlineoverridevirtual |
Iterates to the next "point of interest" of the Mapping.
Throws an NoNextIteratorException if there is no next point of interest.
This method has constant complexity.
Implements inet::physicallayer::ConstMappingIterator.
|
private |
Assignment operator is not allowed.
|
protected |
The dimensions of the underlying ConstMapping.
Referenced by inet::physicallayer::SimpleConstMapping::initializeArguments(), and SimpleConstMappingIterator().
|
protected |
A pointer to a set of Arguments defining the positions to iterate over.
Referenced by inet::physicallayer::SimpleConstMapping::createKeyEntries(), and inet::physicallayer::SimpleConstMapping::initializeArguments().
|
protected |
The underlying ConstMapping to iterate over.
|
protected |
An iterator over the key entry set which defines the next bigger entry of the current position.
Referenced by SimpleConstMappingIterator().
|
protected |
The current position of the iterator.
Referenced by SimpleConstMappingIterator().