OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
OSEdBuildCmdoperator= (const OSEdBuildCmd &)
 Assignment not allowed.
 

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}
static const std::string CMD_NAME_BUILD
Build command name.

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
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}
wxWindow * parentWindow() const
Definition GUICommand.cc:75
static OSEdTextGenerator & instance()
@ TXT_STATUS_COMPILE_SUCCESS
Status bar text when compiling was successful.
@ TXT_STATUS_COMPILE_FAILED
Status bar text when compilation failed.
@ TXT_BUILD_RESULT_DIALOG_TITLE
Build result dialog title.
@ TXT_STATUS_COMPILING
Status bar text when compiling.
wxTreeItemId selectedModuleId()
std::string pathOfModule(wxTreeItemId id)
std::string selectedModule()
static OperationBuilder & instance()
bool buildObject(const std::string &baseName, const std::string &behaviorFile, const std::string &path, std::vector< std::string > &output)
static const wxString DIALOG_NAME
Name of the dialog so it can be found with wxWindow::FindWindowByName.
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)

References OperationBuilder::buildObject(), SimulateDialog::DIALOG_NAME, OperationBuilder::instance(), OSEdTextGenerator::instance(), 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}
@ CMD_BUILD
Build command id.

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}
OSEdTreeView * treeView() const

References 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: