OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ProximExecuteFileCmd Class Reference

#include <ProximExecuteFileCmd.hh>

Inheritance diagram for ProximExecuteFileCmd:
Inheritance graph
Collaboration diagram for ProximExecuteFileCmd:
Collaboration graph

Public Member Functions

 ProximExecuteFileCmd ()
 
virtual ~ProximExecuteFileCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual ProximExecuteFileCmdcreate () 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 executing commands from a log file.

Definition at line 43 of file ProximExecuteFileCmd.hh.

Constructor & Destructor Documentation

◆ ProximExecuteFileCmd()

ProximExecuteFileCmd::ProximExecuteFileCmd ( )

The Constructor.

Definition at line 49 of file ProximExecuteFileCmd.cc.

49 :
51
53}
static const std::string COMMAND_NAME_EXECUTE_FILE
Name of the execute file command.
SimulatorFrontend * simulator_
static TracedSimulatorFrontend * frontend()

References ProximToolbox::frontend(), and simulator_.

Referenced by create().

Here is the call graph for this function:

◆ ~ProximExecuteFileCmd()

ProximExecuteFileCmd::~ProximExecuteFileCmd ( )
virtual

The Destructor.

Definition at line 58 of file ProximExecuteFileCmd.cc.

58 {
59}

Member Function Documentation

◆ create()

ProximExecuteFileCmd * ProximExecuteFileCmd::create ( ) const
virtual

Creates and returns a new isntance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 126 of file ProximExecuteFileCmd.cc.

126 {
127 return new ProximExecuteFileCmd();
128}

References ProximExecuteFileCmd().

Here is the call graph for this function:

◆ Do()

bool ProximExecuteFileCmd::Do ( )
virtual

Executes the command.

Implements GUICommand.

Definition at line 66 of file ProximExecuteFileCmd.cc.

66 {
67 wxString message = _T("Choose a file.");
68 wxString wildcard = _T("Command history logs (*.log)|*.log|All files|*.*");
69 wxFileDialog dialog(
70 parentWindow(), message, _T(""), _T(""), wildcard, wxOPEN);
71
72 if (dialog.ShowModal() == wxID_CANCEL) {
73 return false;
74 }
75
76 std::string filename = WxConversion::toString(dialog.GetPath());
77 std::ifstream file(filename.c_str());
78
79 if (file.bad()) {
80 wxString message = _T("Error opening file '");
81 message.Append(dialog.GetPath());
82 message.Append(_T("'."));
83 ErrorDialog dialog(parentWindow(), message);
84 dialog.ShowModal();
85 return false;
86 }
87
89
90 while (!file.eof()) {
91 std::string command;
92 getline(file, command);
93 lineReader.input(command);
94 }
95
96 return true;
97}
wxWindow * parentWindow() const
Definition GUICommand.cc:75
void input(std::string command)
static ProximLineReader & lineReader()
static std::string toString(const wxString &source)

References ProximLineReader::input(), ProximToolbox::lineReader(), GUICommand::parentWindow(), and WxConversion::toString().

Here is the call graph for this function:

◆ icon()

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

Returns full path to the command icon file.

Returns
Full path to the command icon file.

Implements GUICommand.

Definition at line 106 of file ProximExecuteFileCmd.cc.

106 {
107 return "exec.png";
108}

◆ id()

int ProximExecuteFileCmd::id ( ) const
virtual

Returns ID of this command.

Implements GUICommand.

Definition at line 115 of file ProximExecuteFileCmd.cc.

References ProximConstants::COMMAND_EXECUTE_FILE.

◆ isEnabled()

bool ProximExecuteFileCmd::isEnabled ( )
virtual

Returns true if the command is enabled, false otherwise.

Returns
True if the simulation is initialized or stopped.

Implements GUICommand.

Definition at line 137 of file ProximExecuteFileCmd.cc.

137 {
138
139 if (simulator_ != NULL) {
140 return true;
141 } else {
142 return false;
143 }
144}

References simulator_.

Member Data Documentation

◆ simulator_

SimulatorFrontend* ProximExecuteFileCmd::simulator_
private

Definition at line 54 of file ProximExecuteFileCmd.hh.

Referenced by isEnabled(), and ProximExecuteFileCmd().


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