Search code examples
omnet++veins

What calls the initialize method in application CPP file in veins?


void myAPP::initialize(int stage) {
    ....
}

I am trying to understand what calls? I have done the tictoc tutorial but the initialize method in there does not have int stage as a parameter. Can someone shine some light?


Solution

  • Multi-stage initialization (i.e. initialize with stage parameter) is used by the simulation environment if a module contains redefined numInitStages() method.

    Example 1:
    No redefinition numInitStages() in the class.
    The simulation environment calls method:

    • initialize()

    Example 2:
    The class contains:

    int numInitStages() const { return 3; }
    void initialize(int stage);
    

    The simulation environment calls methods:

    • initialize(0)

    • initialize(1)

    • initialize(2)

    TicToc examples don't have numInitStages() so initialize() without parameters is called.