GateIterator Class Reference

API: cModule::GateIterator Class Reference
API
cModule::GateIterator Class Reference

Public Member Functions

 GateIterator (const cModule *module)
void reset ()
cGateoperator* () const
bool end () const
GateIteratoroperator++ ()
GateIterator operator++ (int)

Description

Iterates through the gates of a module.

Usage:

for (cModule::GateIterator it(module); !it.end(); ++it) {
cGate *gate = *it;
...
}
Iterates through the gates of a module.
Definition cmodule.h:68
virtual cGate * gate(const char *gatename, int index=-1)

Constructor & Destructor Documentation

◆ GateIterator()

GateIterator ( const cModule * module)
inline

Constructor. It takes the 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 GateIterator().

◆ operator*()

cGate * operator* ( ) const
inline

Returns the current gate, or nullptr if the iterator is not at a valid position.

References end().

◆ end()

bool end ( ) const

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

Referenced by operator*(), operator++(), and operator++().

◆ operator++() [1/2]

GateIterator & operator++ ( )
inline

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

References end(), and GateIterator().

◆ operator++() [2/2]

GateIterator operator++ ( int )
inline

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

References end(), and GateIterator().