OMNeT++ Simulation Library
5.6.1
|
#include <cmodule.h>
Walks along the channels inside a module, that is, the channels among the module and its submodules.
This is the same set of channels whose getParentModule() would return the iterated module.
Implementation note:
This iterator precollects the channels into an internal std::vector, then iterates over that. This means that (1) changes made during the iterator's lifetime will not be reflected in the iterator, and (2) copying the iterator is expensive. As a result of (2), no postfix increment/decrement iterators are provided to prevent their accidental use instead of the prefix operators. (Their lack can be trivially circumvented where needed.)
Usage:
Public Member Functions | |
ChannelIterator (const cModule *parentModule) | |
void | init (const cModule *parentModule) |
cChannel * | operator* () const |
_OPPDEPRECATED cChannel * | operator() () const |
bool | end () const |
ChannelIterator & | operator++ () |
ChannelIterator & | operator-- () |
ChannelIterator | ( | const cModule * | parentModule | ) |
Constructor. The iterator will walk on the module passed as argument.
void init | ( | const cModule * | parentModule | ) |
Reinitializes the iterator object.
|
inline |
Returns a pointer to the current channel. Returns nullptr if the iterator has reached the end of the list.
|
inline |
DEPRECATED. Use the * operator to access the object the iterator is at.
|
inline |
Returns true if the iterator has reached the end.
|
inline |
Prefix increment operator (++it). Moves the iterator to the next channel in the list. It has no effect if the iterator has reached either end of the list.
Note: postfix increment/decrement operators are not provided, to avoid large unnecessary copying overhead resulting from accidental use.
|
inline |
Prefix decrement operator (–it). Moves the iterator to the previous channel in the list. It has no effect if the iterator has reached either end of the list.
Note: postfix increment/decrement operators are not provided, to avoid large unnecessary copying overhead resulting from accidental use.