SST  14.1.0
StructuralSimulationToolkit
interactiveAction.h
1 // Copyright 2009-2024 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2024, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_INTERACTIVE_ACTION_H
13 #define SST_CORE_INTERACTIVE_ACTION_H
14 
15 #include "sst/core/action.h"
16 // Can include this because this header is not installed
17 #include "sst/core/simulation_impl.h"
18 
19 
20 namespace SST {
21 
22 /**
23  \class InteractiveAction An event to trigger interactive mode. This
24  is a "one shot" event and will delete itself on execute()
25 */
26 class InteractiveAction : public Action
27 {
28 public:
29  /**
30  Create a new InteractiveAction object for the simulation core to initiate interactive mode
31  */
32  InteractiveAction(Simulation_impl* sim, const std::string& msg) : Action(), sim_(sim), msg_(msg)
33  {
34  setPriority(INTERACTIVEPRIOIRTY);
35  }
36 
37  ~InteractiveAction() {}
38 
39  /** Called by TimeVortex to trigger interactive mode. */
40  void execute() override
41  {
42  sim_->enter_interactive_ = true;
43  sim_->interactive_msg_ = msg_;
44  delete this;
45  }
46 
47 private:
48  Simulation_impl* sim_;
49  std::string msg_;
50 };
51 
52 } // namespace SST
53 #endif // SST_CORE_INTERACTIVE_ACTION_H
An Action is a schedulable Activity which is not an Event.
Definition: action.h:26
void execute() override
Called by TimeVortex to trigger interactive mode.
Definition: interactiveAction.h:40
to trigger interactive mode.
Definition: interactiveAction.h:26
void setPriority(uint64_t priority)
Set the priority of the Activity.
Definition: activity.h:185
Definition: action.cc:18
Main control class for a SST Simulation.
Definition: simulation_impl.h:76
InteractiveAction(Simulation_impl *sim, const std::string &msg)
Create a new InteractiveAction object for the simulation core to initiate interactive mode...
Definition: interactiveAction.h:32