OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000415OMNeT++simulation kernelpublic2011-10-03 16:182011-10-03 16:50
0000415: cModule initialization status - optimisation
The function cModule::initializeModules(int stage) sets FL_INITIALIZED flag when initialization of this module finished, and its all submodules initialized, too.

When stage larger than 0 and this module is already initialized, the call of submod()->initializeModules(stage) is unnecessary.
No tags attached.
Issue History
2011-10-03 16:18zbojtheNew Issue
2011-10-03 16:50zbojtheNote Added: 0000569

2011-10-03 16:50   
The patch for

bool cModule::initializeModules(int stage)
    if (simulation.getContextType()!=CTX_INITIALIZE)
        throw cRuntimeError("internal function initializeModules() may only be called via callInitialize()");

    if (stage==0)
        if (initialized())
            throw cRuntimeError(this, "initialize() already called for this module");

        // call buildInside() if user has forgotten to do it; this is needed
        // to make dynamic module creation more robust
        if (!buildInsideCalled())

+ if (initialized())
+ return false;
    // first call initialize(stage) for this module...
    int numStages = numInitStages();