SubmoduleIterator Class Reference¶
|
API
|
Public Member Functions | |
| SubmoduleIterator (const cModule *module) | |
| void | reset () |
| cModule * | operator* () const |
| bool | end () const |
| SubmoduleIterator & | operator++ () |
| SubmoduleIterator | operator++ (int) |
| bool | changesDetected () const |
Description
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:
Constructor & Destructor Documentation
◆ SubmoduleIterator()
|
inline |
Constructor. It takes the parent module on which to iterate.
References cModule::cModule(), and reset().
Referenced by operator++(), and operator++().
Member Function Documentation
◆ reset()
| void reset | ( | ) |
Reinitializes the iterator.
Referenced by SubmoduleIterator().
◆ operator*()
|
inline |
Returns a pointer to the current module. Returns nullptr if the iterator has reached the end of the list.
References cModule::cModule().
◆ end()
|
inline |
Returns true if the iterator reached the end of the list.
◆ operator++() [1/2]
|
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.
References SubmoduleIterator().
◆ operator++() [2/2]
|
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.
References SubmoduleIterator().
◆ changesDetected()
| 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()).
Generated on for API by