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

#include <OSEdBuildAllCmd.hh>

Inheritance diagram for OSEdBuildAllCmd:
Inheritance graph
Collaboration diagram for OSEdBuildAllCmd:
Collaboration graph

Public Member Functions

 OSEdBuildAllCmd ()
 
virtual ~OSEdBuildAllCmd ()
 
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

 OSEdBuildAllCmd (const OSEdBuildAllCmd &)
 Copying not allowed.
 
OSEdBuildAllCmdoperator= (const OSEdBuildAllCmd &)
 Assignment not allowed.
 

Detailed Description

Command that build all modules.

Definition at line 43 of file OSEdBuildAllCmd.hh.

Constructor & Destructor Documentation

◆ OSEdBuildAllCmd() [1/2]

OSEdBuildAllCmd::OSEdBuildAllCmd ( )

Constructor.

Definition at line 57 of file OSEdBuildAllCmd.cc.

57 :
59}
static const std::string CMD_NAME_BUILD_ALL
Build all command name.

Referenced by create().

◆ ~OSEdBuildAllCmd()

OSEdBuildAllCmd::~OSEdBuildAllCmd ( )
virtual

Destructor.

Definition at line 64 of file OSEdBuildAllCmd.cc.

64 {
65}

◆ OSEdBuildAllCmd() [2/2]

OSEdBuildAllCmd::OSEdBuildAllCmd ( const OSEdBuildAllCmd )
private

Copying not allowed.

Member Function Documentation

◆ create()

GUICommand * OSEdBuildAllCmd::create ( ) const
virtual

Returns a new command.

Returns
A new command.

Implements GUICommand.

Definition at line 83 of file OSEdBuildAllCmd.cc.

83 {
84 return new OSEdBuildAllCmd();
85}

References OSEdBuildAllCmd().

Here is the call graph for this function:

◆ Do()

bool OSEdBuildAllCmd::Do ( )
virtual

Executes the command.

Returns
True if execution is successful.

Implements GUICommand.

Definition at line 93 of file OSEdBuildAllCmd.cc.

93 {
94
95 wxWindow* simulateDialog =
96 wxGetApp().mainFrame()->FindWindowByName(SimulateDialog::DIALOG_NAME);
97
98 if (simulateDialog != NULL) {
99 simulateDialog->Close();
100 }
101
105 wxStatusBar* statusBar = wxGetApp().mainFrame()->statusBar();
106
107 vector<OperationModule> buildModules;
108 vector<string> paths;
109 for (int i = 0; i < index.pathCount(); i++) {
110
111 string path = index.path(i);
112 for (int k = 0; k < index.moduleCount(path); k++) {
113
114 OperationModule& module = index.module(k, path);
115 if (module.hasBehaviorSource()) {
116 buildModules.push_back(module);
117 paths.push_back(path);
118 }
119 }
120 }
121
122 vector<string> output;
123 wxStopWatch sw;
124 sw.Pause();
125 wxBusyCursor* busy = new wxBusyCursor();
126 bool compileOk = true;
127 for (size_t i = 0; i < buildModules.size(); i++) {
128 OperationModule module = buildModules[i];
129 string path = paths[i];
130 output.push_back(module.name() + ":\n");
131 size_t oldSize = output.size();
132
133 sw.Resume();
134 builder.buildObject(module.name(),
135 module.behaviorSourceModule(),
136 path, output);
137 sw.Pause();
138
139 if (oldSize != output.size()) {
140 compileOk = false;
141 }
142 output.push_back("\n");
143 }
144
145 delete busy;
146
147 if (!compileOk) {
149 statusBar->SetStatusText(WxConversion::toWxString(fmt.str()));
151 ResultDialog dialog(parentWindow(), output, fmt.str());
152 dialog.ShowModal();
153 } else {
155 fmt % sw.Time();
156 statusBar->SetStatusText(WxConversion::toWxString(fmt.str()));
157 }
158 return true;
159}
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.
static OperationBuilder & instance()
bool buildObject(const std::string &baseName, const std::string &behaviorFile, const std::string &path, std::vector< std::string > &output)
static OperationIndex & operationIndex()
std::string path(int i) const
int pathCount() const
int moduleCount() const
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(), OperationIndex::moduleCount(), OperationContainer::operationIndex(), GUICommand::parentWindow(), OperationIndex::path(), OperationIndex::pathCount(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_BUILD_RESULT_DIALOG_TITLE, OSEdTextGenerator::TXT_STATUS_COMPILE_FAILED, and OSEdTextGenerator::TXT_STATUS_COMPILE_SUCCESS.

Here is the call graph for this function:

◆ icon()

string OSEdBuildAllCmd::icon ( ) const
virtual

Returns icon path.

Returns
Empty string (icons not used).

Implements GUICommand.

Definition at line 186 of file OSEdBuildAllCmd.cc.

186 {
187 return "";
188}

◆ id()

int OSEdBuildAllCmd::id ( ) const
virtual

Returns the id of the command.

Returns
The id of the command.

Implements GUICommand.

Definition at line 73 of file OSEdBuildAllCmd.cc.

73 {
75}
@ CMD_BUILD_ALL
Build all command id.

References OSEdConstants::CMD_BUILD_ALL.

◆ isEnabled()

bool OSEdBuildAllCmd::isEnabled ( )
virtual

Returns true if command is enabled.

Command is enabled, if at least one module has behavior source file.

Returns
True if command is enabled.

Implements GUICommand.

Definition at line 169 of file OSEdBuildAllCmd.cc.

169 {
171 for (int i = 0; i < index.moduleCount(); i++) {
172 OperationModule& module = index.module(i);
173 if (module.hasBehaviorSource()) {
174 return true;
175 }
176 }
177 return false;
178}

References OperationIndex::moduleCount(), and OperationContainer::operationIndex().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.


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