ChannelIterator Class Reference

API: cModule::ChannelIterator Class Reference
API
cModule::ChannelIterator Class Reference

Public Member Functions

 ChannelIterator (const cModule *module)
void reset ()
cChanneloperator* () const
bool end () const
ChannelIteratoroperator++ ()
ChannelIterator operator++ (int)

Description

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.

Usage:

for (cModule::ChannelIterator it(module); !it.end(); ++it) {
cChannel *channel = *it;
...
}
Walks along the channels inside a module, that is, the channels among the module and its submodules.
Definition cmodule.h:228
bool end() const
Definition cmodule.h:257

Constructor & Destructor Documentation

◆ ChannelIterator()

ChannelIterator ( const cModule * module)
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 ChannelIterator().

◆ operator*()

cChannel * operator* ( ) const
inline

Returns a pointer to the current channel. Returns nullptr if the iterator has reached the end of the list.

◆ end()

bool end ( ) const
inline

Returns true if the iterator reached the end of the list.

◆ operator++() [1/2]

ChannelIterator & operator++ ( )
inline

Prefix increment operator (++it). Moves the iterator to the next channel. It has no effect if the iterator has reached either end of the list.

References ChannelIterator().

◆ operator++() [2/2]

ChannelIterator operator++ ( int )
inline

Postfix increment operator (it++). Moves the iterator to the next channel, and returns the iterator's previous state. It has no effect if the iterator has reached either end of the list.

References ChannelIterator().