You copied the Doc URL to your clipboard.

API functions for managing event callbacks

SoC Designer enables you to register callbacks for the following events:

  • Start or stop of simulation (SimStatusListener).
  • Reset of simulation (ResetListener).
  • Begin of simulation cycle (CycleStartListener).
  • End of communicate phase (EndOfCommunicateListener).
  • End of simulation cycle (CycleListener).
  • Simulator is about to quit (SimQuitListener).

The callback interfaces are implemented using C++ classes that handle the callbacks. Each callback event type provides its own pure virtual interface. The callback handlers can be registered by using one of the following functions:

  • simulator->registerStatusListener(MyStatusListener);
  • simulator->registerResetListener(MyResetListener);
  • simulator->registerCycleStartListener(MyCycleStartListener);
  • simulator->registeEndOfCommunicateListener(MyEndOfCommunicateListener);
  • simulator->registerCycleListener(MyCycleListener);
  • simulator->registerSimQuitListener(MySimQuitListener);

To register a callback:

  1. Create an object that inherits from the appropriate listener class.
  2. Implement the callback function associated with the listener class.
  3. Register the callback by calling the appropriate registerTypeListener() method of the MxSimAPI object with your listener object as the parameter.

To unregister a callback handler added by registerTypeListener(), call the corresponding unregisterTypeListener() function.

Was this page helpful? Yes No