OMNeT++ Simulation Library
6.0.3
|
#include <cmodule.h>
Iterates through the submodules of a compound module. Iteration order corresponds to declaration order in NED files.
It is not allowed to delete or insert modules during iteration. If such thing occurs, restart the iteration by calling reset(), or query the submodule list in advance.
Usage:
When submodules may be created in the loop body:
Public Member Functions | |
SubmoduleIterator (const cModule *module) | |
void | reset () |
cModule * | operator* () const |
bool | end () const |
SubmoduleIterator & | operator++ () |
SubmoduleIterator | operator++ (int) |
bool | changesDetected () const |
|
inline |
Constructor. It takes the parent module on which to iterate.
void reset | ( | ) |
Reinitializes the iterator.
|
inline |
Returns a pointer to the current module. Returns nullptr if the iterator has reached the end of the list.
|
inline |
Returns true if the iterator reached the end of the list.
|
inline |
Prefix increment operator (++it). Moves the iterator to the next submodule. It has no effect if the iterator has reached either end of the list.
|
inline |
Postfix increment operator (it++). Moves the iterator to the next submodule, and returns the iterator's previous state. It has no effect if the iterator has reached either end of the list.
bool changesDetected | ( | ) | const |
Returns true if it was detected that the list of submodules has changed since the the start of the iteration due to insertion, removal, or possibly as a byproduct of name/index change. When this method returns true, incrementing the iterator will result in an exception being thrown. One possible solution for when changesDetected() returns true is starting over the iteration (see reset()).