OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
ProximKillCmd Class Reference

#include <ProximKillCmd.hh>

Inheritance diagram for ProximKillCmd:
Inheritance graph
Collaboration diagram for ProximKillCmd:
Collaboration graph

Public Member Functions

 ProximKillCmd ()
 
virtual ~ProximKillCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual ProximKillCmdcreate () const
 
virtual std::string icon () const
 
virtual bool isEnabled ()
 
- Public Member Functions inherited from GUICommand
 GUICommand (std::string name, wxWindow *parent)
 
virtual ~GUICommand ()
 
virtual bool isChecked () const
 
virtual std::string shortName () const
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Private Attributes

SimulatorFrontendsimulator_
 

Detailed Description

Command for terminating simulation in Proxim.

Definition at line 43 of file ProximKillCmd.hh.

Constructor & Destructor Documentation

◆ ProximKillCmd()

ProximKillCmd::ProximKillCmd ( )

The Constructor.

Definition at line 43 of file ProximKillCmd.cc.

43  :
45 
46  simulator_ = wxGetApp().simulation()->frontend();
47 }

References simulator_.

Referenced by create().

◆ ~ProximKillCmd()

ProximKillCmd::~ProximKillCmd ( )
virtual

The Destructor.

Definition at line 52 of file ProximKillCmd.cc.

52  {
53 }

Member Function Documentation

◆ create()

ProximKillCmd * ProximKillCmd::create ( ) const
virtual

Creates and returns a new isntance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 101 of file ProximKillCmd.cc.

101  {
102  return new ProximKillCmd();
103 }

References ProximKillCmd().

Here is the call graph for this function:

◆ Do()

bool ProximKillCmd::Do ( )
virtual

Executes the command.

Implements GUICommand.

Definition at line 60 of file ProximKillCmd.cc.

60  {
61  assert(parentWindow() != NULL);
62  wxString message = _T("Are you sure you want to restart simulation?");
63  wxString title = _T("Confirm kill");
64  wxMessageDialog dialog(
65  parentWindow(), message, title, wxYES_NO | wxCENTRE | wxICON_QUESTION);
66 
67  if (dialog.ShowModal() == wxID_YES) {
68  wxGetApp().simulation()->killSimulation();
69  }
70 
71  return true;
72 }

References assert, and GUICommand::parentWindow().

Here is the call graph for this function:

◆ icon()

std::string ProximKillCmd::icon ( ) const
virtual

Returns full path to the command icon file.

Returns
Full path to the command icon file.

Implements GUICommand.

Definition at line 81 of file ProximKillCmd.cc.

81  {
82  return "kill.png";
83 }

◆ id()

int ProximKillCmd::id ( ) const
virtual

Returns ID of this command.

Implements GUICommand.

Definition at line 90 of file ProximKillCmd.cc.

90  {
92 }

References ProximConstants::COMMAND_KILL.

◆ isEnabled()

bool ProximKillCmd::isEnabled ( )
virtual

Returns true if the command is enabled, false otherwise.

Returns
True if the simulation is running.

Implements GUICommand.

Definition at line 112 of file ProximKillCmd.cc.

112  {
113  if (simulator_ != NULL &&
117 
118  return true;
119  } else {
120  return false;
121  }
122 }

References SimulatorFrontend::hasSimulationEnded(), SimulatorFrontend::isSimulationRunning(), SimulatorFrontend::isSimulationStopped(), and simulator_.

Here is the call graph for this function:

Member Data Documentation

◆ simulator_

SimulatorFrontend* ProximKillCmd::simulator_
private

Definition at line 54 of file ProximKillCmd.hh.

Referenced by isEnabled(), and ProximKillCmd().


The documentation for this class was generated from the following files:
SimulatorFrontend::isSimulationStopped
bool isSimulationStopped() const
Definition: SimulatorFrontend.cc:1271
assert
#define assert(condition)
Definition: Application.hh:86
ProximConstants::COMMAND_NAME_KILL
static const std::string COMMAND_NAME_KILL
Name of the kill command.
Definition: ProximConstants.hh:126
SimulatorFrontend::isSimulationRunning
bool isSimulationRunning() const
Definition: SimulatorFrontend.cc:1260
GUICommand::GUICommand
GUICommand(std::string name, wxWindow *parent)
Definition: GUICommand.cc:42
ProximKillCmd::ProximKillCmd
ProximKillCmd()
Definition: ProximKillCmd.cc:43
SimulatorFrontend::hasSimulationEnded
bool hasSimulationEnded() const
Definition: SimulatorFrontend.cc:1283
ProximKillCmd::simulator_
SimulatorFrontend * simulator_
Definition: ProximKillCmd.hh:54
ProximConstants::COMMAND_KILL
@ COMMAND_KILL
Definition: ProximConstants.hh:64
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75