OpenASIP  2.0
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. More...
 
OSEdBuildAllCmdoperator= (const OSEdBuildAllCmd &)
 Assignment not allowed. More...
 

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 }

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 }

References OperationModule::behaviorSourceModule(), OperationBuilder::buildObject(), SimulateDialog::DIALOG_NAME, OperationModule::hasBehaviorSource(), OSEdTextGenerator::instance(), OperationBuilder::instance(), OperationIndex::module(), OperationIndex::moduleCount(), OperationModule::name(), 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 }

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 OperationModule::hasBehaviorSource(), OperationIndex::module(), 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:
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)
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
OperationIndex::pathCount
int pathCount() const
OperationBuilder
Definition: OperationBuilder.hh:42
OSEdTextGenerator::TXT_STATUS_COMPILE_FAILED
@ TXT_STATUS_COMPILE_FAILED
Status bar text when compilation failed.
Definition: OSEdTextGenerator.hh:222
OperationModule::behaviorSourceModule
virtual std::string behaviorSourceModule() const
Definition: OperationModule.cc:144
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
OSEdBuildAllCmd::OSEdBuildAllCmd
OSEdBuildAllCmd()
Definition: OSEdBuildAllCmd.cc:57
SimulateDialog::DIALOG_NAME
static const wxString DIALOG_NAME
Name of the dialog so it can be found with wxWindow::FindWindowByName.
Definition: SimulateDialog.hh:66
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
OperationIndex::moduleCount
int moduleCount() const
OperationModule
Definition: OperationModule.hh:46
OperationModule::hasBehaviorSource
virtual bool hasBehaviorSource() const
Definition: OperationModule.cc:131
OSEdConstants::CMD_NAME_BUILD_ALL
static const std::string CMD_NAME_BUILD_ALL
Build all command name.
Definition: OSEdConstants.hh:65
OperationIndex::path
std::string path(int i) const
OperationIndex
Definition: OperationIndex.hh:58
OSEdTextGenerator::instance
static OSEdTextGenerator & instance()
Definition: OSEdTextGenerator.cc:214
OSEdConstants::CMD_BUILD_ALL
@ CMD_BUILD_ALL
Build all command id.
Definition: OSEdConstants.hh:99
OSEdTextGenerator
Definition: OSEdTextGenerator.hh:42
OperationModule::name
virtual std::string name() const
Definition: OperationModule.cc:160
OperationContainer::operationIndex
static OperationIndex & operationIndex()
Definition: OperationContainer.cc:94
OperationIndex::module
OperationModule & module(int i)
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
OperationBuilder::instance
static OperationBuilder & instance()
Definition: OperationBuilder.cc:71