The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::app::Simulation::SimulationController Class Reference

This class is used for simulation control callbacks. More...

#include <Simulation.hpp>

Public Types

enum class  SimulationStatus { Idle , Paused , Simulating , Terminated }
 

Public Member Functions

void pause ()
 
void resume ()
 
void terminate ()
 
void invokeNamedEvent (const std::string &event_name)
 
SimulationStatus getSimStatus () const
 

Protected Member Functions

 SimulationController (const sparta::app::Simulation *sim)
 
void addNamedCallback_ (const std::string &event_name, SpartaHandler callback_method)
 

Friends

class sparta::app::Simulation
 

Detailed Description

This class is used for simulation control callbacks.

The callback conditions (trigger expressions) are specified in control YAML files (and eventually the pythong shell). The purpose of this class in the command line fashion (see example/CoreModel/ctrl.yaml) is to allow the user to "control" simulation during runtime by relating behaviors (like start, stop, resume) with simulation triggers. Simulation triggers can be sparta::NotificationSource, sparta::Counter, sparta::StatisicDef, other expressions.

A use case for such a control could include the simulation is instructed to send a notification (via sparta::NotificationSource) when a specific address of a test case is encountered. The modeler could have a trigger set up on that notification to stop simulation:

# stop on address hit (stop.yaml)
control:
stop: notif.address_hit

And the simulation:

./my_simulator ...<args>... --control stop.yaml

Definition at line 462 of file Simulation.hpp.

Member Enumeration Documentation

◆ SimulationStatus

enum class sparta::app::Simulation::SimulationController::SimulationStatus
strong

Definition at line 474 of file Simulation.hpp.

Constructor & Destructor Documentation

◆ ~SimulationController()

virtual sparta::app::Simulation::SimulationController::~SimulationController ( )
inlinevirtual

Definition at line 465 of file Simulation.hpp.

◆ SimulationController()

sparta::app::Simulation::SimulationController::SimulationController ( const sparta::app::Simulation sim)
inlineexplicitprotected

Definition at line 485 of file Simulation.hpp.

Member Function Documentation

◆ getSimStatus()

SimulationStatus sparta::app::Simulation::SimulationController::getSimStatus ( ) const
inline

Definition at line 480 of file Simulation.hpp.

Friends And Related Symbol Documentation

◆ sparta::app::Simulation

friend class sparta::app::Simulation
friend

Definition at line 511 of file Simulation.hpp.


The documentation for this class was generated from the following file: