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

#include <OSEdBuildCmd.hh>

Inheritance diagram for OSEdBuildCmd:
Inheritance graph
Collaboration diagram for OSEdBuildCmd:
Collaboration graph

Public Member Functions

 OSEdBuildCmd ()
 
virtual ~OSEdBuildCmd ()
 
virtual int id () const
 
virtual GUICommandcreate () const
 
virtual bool Do ()
 
virtual bool isEnabled ()
 
virtual std::string icon () const
 
- 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 Member Functions

 OSEdBuildCmd (const OSEdBuildCmd &)
 Copying not allowed. More...
 
OSEdBuildCmdoperator= (const OSEdBuildCmd &)
 Assignment not allowed. More...
 

Detailed Description

Command that builds a module.

Definition at line 43 of file OSEdBuildCmd.hh.

Constructor & Destructor Documentation

◆ OSEdBuildCmd() [1/2]

OSEdBuildCmd::OSEdBuildCmd ( )

Constructor.

Definition at line 56 of file OSEdBuildCmd.cc.

56  :
58 }

Referenced by create().

◆ ~OSEdBuildCmd()

OSEdBuildCmd::~OSEdBuildCmd ( )
virtual

Destructor.

Definition at line 63 of file OSEdBuildCmd.cc.

63  {
64 }

◆ OSEdBuildCmd() [2/2]

OSEdBuildCmd::OSEdBuildCmd ( const OSEdBuildCmd )
private

Copying not allowed.

Member Function Documentation

◆ create()

GUICommand * OSEdBuildCmd::create ( ) const
virtual

Creates a new command.

Returns
A new command.

Implements GUICommand.

Definition at line 82 of file OSEdBuildCmd.cc.

82  {
83  return new OSEdBuildCmd();
84 }

References OSEdBuildCmd().

Here is the call graph for this function:

◆ Do()

bool OSEdBuildCmd::Do ( )
virtual

Executes the command.

Returns
True if execution is successful.

Implements GUICommand.

Definition at line 92 of file OSEdBuildCmd.cc.

92  {
93 
94  wxWindow* simulateDialog =
95  wxGetApp().mainFrame()->FindWindowByName(SimulateDialog::DIALOG_NAME);
96 
97  if (simulateDialog != NULL) {
98  simulateDialog->Close();
99  }
100 
102  wxStatusBar* statusBar = wxGetApp().mainFrame()->statusBar();
103  OSEdTreeView* treeView = wxGetApp().mainFrame()->treeView();
104 
105  string modName = treeView->selectedModule();
106  wxTreeItemId modId = treeView->selectedModuleId();
107  string pathName = treeView->pathOfModule(modId);
108  OperationModule& module = OperationContainer::module(pathName, modName);
109 
110  format fmt = texts.text(OSEdTextGenerator::TXT_STATUS_COMPILING);
111  fmt % module.name();
112  statusBar->SetStatusText(WxConversion::toWxString(fmt.str()));
113 
114  vector<string> output;
115  output.push_back(module.name() + ":\n");
117  size_t oldSize = output.size();
118 
119  wxStopWatch sw;
120  wxBusyCursor* busy = new wxBusyCursor();
121  builder.buildObject(
122  module.name(), module.behaviorSourceModule(), pathName, output);
123  delete busy;
124  sw.Pause();
125 
126  if (oldSize == output.size()) {
128  fmt % sw.Time();
129  statusBar->SetStatusText(WxConversion::toWxString(fmt.str()));
130  } else {
132  statusBar->SetStatusText(WxConversion::toWxString(fmt.str()));
134  ResultDialog dialog(parentWindow(), output, fmt.str(),
135  module.behaviorSourceModule());
136  dialog.ShowModal();
137  }
138  return true;
139 }

References OperationModule::behaviorSourceModule(), OperationBuilder::buildObject(), SimulateDialog::DIALOG_NAME, OSEdTextGenerator::instance(), OperationBuilder::instance(), OperationContainer::module(), OperationModule::name(), GUICommand::parentWindow(), OSEdTreeView::pathOfModule(), OSEdTreeView::selectedModule(), OSEdTreeView::selectedModuleId(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_BUILD_RESULT_DIALOG_TITLE, OSEdTextGenerator::TXT_STATUS_COMPILE_FAILED, OSEdTextGenerator::TXT_STATUS_COMPILE_SUCCESS, and OSEdTextGenerator::TXT_STATUS_COMPILING.

Here is the call graph for this function:

◆ icon()

string OSEdBuildCmd::icon ( ) const
virtual

Returns the icon path.

Returns
Empty string (icons not used).

Implements GUICommand.

Definition at line 169 of file OSEdBuildCmd.cc.

169  {
170  return "";
171 }

◆ id()

int OSEdBuildCmd::id ( ) const
virtual

Returns the id of the command.

Returns
The id of the command.

Implements GUICommand.

Definition at line 72 of file OSEdBuildCmd.cc.

72  {
74 }

References OSEdConstants::CMD_BUILD.

◆ isEnabled()

bool OSEdBuildCmd::isEnabled ( )
virtual

Returns true if command is enabled.

Command is enabled when module with behavior source file has been selected.

Returns
True if command is enabled.

Implements GUICommand.

Definition at line 150 of file OSEdBuildCmd.cc.

150  {
151  OSEdMainFrame* mainFrame = wxGetApp().mainFrame();
152  OSEdTreeView* treeView = mainFrame->treeView();
153  string modName = treeView->selectedModule();
154  if (modName == "") {
155  return false;
156  }
157  wxTreeItemId modId = treeView->selectedModuleId();
158  string pathName = treeView->pathOfModule(modId);
159  OperationModule& module = OperationContainer::module(pathName, modName);
160  return module.hasBehaviorSource();
161 }

References OperationModule::hasBehaviorSource(), OperationContainer::module(), OSEdTreeView::pathOfModule(), OSEdTreeView::selectedModule(), OSEdTreeView::selectedModuleId(), and OSEdMainFrame::treeView().

Here is the call graph for this function:

◆ operator=()

OSEdBuildCmd& OSEdBuildCmd::operator= ( const OSEdBuildCmd )
private

Assignment not allowed.


The documentation for this class was generated from the following files:
OSEdTreeView::selectedModule
std::string selectedModule()
Definition: OSEdTreeView.cc:513
OSEdTreeView::selectedModuleId
wxTreeItemId selectedModuleId()
Definition: OSEdTreeView.cc:537
OSEdTextGenerator::TXT_BUILD_RESULT_DIALOG_TITLE
@ TXT_BUILD_RESULT_DIALOG_TITLE
Build result dialog title.
Definition: OSEdTextGenerator.hh:115
WxConversion::toWxString
static wxString toWxString(const std::string &source)
OSEdTreeView::pathOfModule
std::string pathOfModule(wxTreeItemId id)
Definition: OSEdTreeView.cc:431
OSEdConstants::CMD_BUILD
@ CMD_BUILD
Build command id.
Definition: OSEdConstants.hh:98
OperationContainer::module
static OperationModule & module(const std::string &path, const std::string &mod)
Definition: OperationContainer.cc:148
OSEdTextGenerator::TXT_STATUS_COMPILING
@ TXT_STATUS_COMPILING
Status bar text when compiling.
Definition: OSEdTextGenerator.hh:219
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
OSEdMainFrame::treeView
OSEdTreeView * treeView() const
Definition: OSEdMainFrame.cc:241
OperationBuilder
Definition: OperationBuilder.hh:42
OSEdTextGenerator::TXT_STATUS_COMPILE_FAILED
@ TXT_STATUS_COMPILE_FAILED
Status bar text when compilation failed.
Definition: OSEdTextGenerator.hh:222
OSEdTreeView
Definition: OSEdTreeView.hh:54
OperationModule::behaviorSourceModule
virtual std::string behaviorSourceModule() const
Definition: OperationModule.cc:144
OSEdBuildCmd::OSEdBuildCmd
OSEdBuildCmd()
Definition: OSEdBuildCmd.cc:56
OSEdTextGenerator::TXT_STATUS_COMPILE_SUCCESS
@ TXT_STATUS_COMPILE_SUCCESS
Status bar text when compiling was successful.
Definition: OSEdTextGenerator.hh:220
ResultDialog
Definition: ResultDialog.hh:44
SimulateDialog::DIALOG_NAME
static const wxString DIALOG_NAME
Name of the dialog so it can be found with wxWindow::FindWindowByName.
Definition: SimulateDialog.hh:66
OSEdMainFrame
Definition: OSEdMainFrame.hh:49
OperationBuilder::buildObject
bool buildObject(const std::string &baseName, const std::string &behaviorFile, const std::string &path, std::vector< std::string > &output)
Definition: OperationBuilder.cc:141
GUICommand::GUICommand
GUICommand(std::string name, wxWindow *parent)
Definition: GUICommand.cc:42
OperationModule
Definition: OperationModule.hh:46
OperationModule::hasBehaviorSource
virtual bool hasBehaviorSource() const
Definition: OperationModule.cc:131
OSEdTextGenerator::instance
static OSEdTextGenerator & instance()
Definition: OSEdTextGenerator.cc:214
OSEdTextGenerator
Definition: OSEdTextGenerator.hh:42
OperationModule::name
virtual std::string name() const
Definition: OperationModule.cc:160
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
OSEdConstants::CMD_NAME_BUILD
static const std::string CMD_NAME_BUILD
Build command name.
Definition: OSEdConstants.hh:63
OperationBuilder::instance
static OperationBuilder & instance()
Definition: OperationBuilder.cc:71