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

#include <AddRFImplementationCmd.hh>

Inheritance diagram for AddRFImplementationCmd:
Inheritance graph
Collaboration diagram for AddRFImplementationCmd:
Collaboration graph

Public Member Functions

 AddRFImplementationCmd ()
 
virtual ~AddRFImplementationCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual AddRFImplementationCmdcreate () 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
 

Detailed Description

Command for adding implementation of a RF architecture to HDB.

Definition at line 41 of file AddRFImplementationCmd.hh.

Constructor & Destructor Documentation

◆ AddRFImplementationCmd()

AddRFImplementationCmd::AddRFImplementationCmd ( )

The Constructor.

Definition at line 49 of file AddRFImplementationCmd.cc.

49 :
51}
static const std::string COMMAND_NAME_ADD_RF_IMPLEMENTATION
Name of the add rf implementation cmd.

Referenced by create().

◆ ~AddRFImplementationCmd()

AddRFImplementationCmd::~AddRFImplementationCmd ( )
virtual

The Destructor.

Definition at line 57 of file AddRFImplementationCmd.cc.

57 {
58}

Member Function Documentation

◆ create()

AddRFImplementationCmd * AddRFImplementationCmd::create ( ) const
virtual

Creates a new instance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 144 of file AddRFImplementationCmd.cc.

144 {
145 return new AddRFImplementationCmd();
146}

References AddRFImplementationCmd().

Here is the call graph for this function:

◆ Do()

bool AddRFImplementationCmd::Do ( )
virtual

Executes the command.

Implements GUICommand.

Definition at line 64 of file AddRFImplementationCmd.cc.

64 {
65
66 HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
67 if (manager == NULL) {
68 return false;
69 }
70
71 HDBBrowserWindow* browser = wxGetApp().mainFrame().browser();
72
74 = new HDB::RFImplementation("", "", "","", "", "", "");
75
76 HDB::RFEntry* entry = NULL;
77
78 if (browser->isRFEntrySelected()) {
79 entry = manager->rfByEntryID(browser->selectedRFEntry());
80 } else if (browser->isRFArchitectureSelected()) {
81 int id = manager->addRFEntry();
82 manager->setArchitectureForRF(id, browser->selectedRFArchitecture());
83 entry = manager->rfByEntryID(id);
84 } else {
85 return false;
86 }
87
89
90 if (dialog.ShowModal() == wxID_OK) {
91 try {
92 int id =
93 manager->addRFImplementation(*implementation, entry->id());
94 wxGetApp().mainFrame().update();
95 wxGetApp().mainFrame().browser()->selectRFImplementation(id);
96 } catch (Exception& e) {
97 wxString message = _T("Error:\n");
98 message.Append(WxConversion::toWxString(e.errorMessage()));
99 message.Append(_T("\n"));
100 message.Append(WxConversion::toWxString(e.lineNum()));
101 message.Append(_T(": "));
102 message.Append(WxConversion::toWxString(e.fileName()));
103 ErrorDialog dialog(parentWindow(), message);
104 dialog.ShowModal();
105 delete entry;
106 delete implementation;
107 return false;
108 }
109 } else {
110 delete implementation;
111 }
112
113 delete entry;
114 return true;
115}
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
std::string fileName() const
std::string errorMessage() const
Definition Exception.cc:123
int lineNum() const
wxWindow * parentWindow() const
Definition GUICommand.cc:75
RowID id() const
Definition HDBEntry.cc:85
RowID addRFEntry() const
void setArchitectureForRF(RowID rfID, RowID archID) const
RowID addRFImplementation(const RFImplementation &implementation, RowID rfEntryID)
RFEntry * rfByEntryID(RowID id) const
static wxString toWxString(const std::string &source)

References HDB::HDBManager::addRFEntry(), HDB::HDBManager::addRFImplementation(), Exception::errorMessage(), Exception::fileName(), HDB::HDBEntry::id(), implementation, HDBBrowserWindow::isRFArchitectureSelected(), HDBBrowserWindow::isRFEntrySelected(), Exception::lineNum(), GUICommand::parentWindow(), HDB::HDBManager::rfByEntryID(), HDBBrowserWindow::selectedRFArchitecture(), HDBBrowserWindow::selectedRFEntry(), HDB::HDBManager::setArchitectureForRF(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ icon()

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

Returns name of the command icon file.

Returns
Command icon file name.

Implements GUICommand.

Definition at line 123 of file AddRFImplementationCmd.cc.

123 {
124 return "";
125}

◆ id()

int AddRFImplementationCmd::id ( ) const
virtual

Returns the command id.

Returns
Command identifier.

Implements GUICommand.

Definition at line 133 of file AddRFImplementationCmd.cc.

References HDBEditorConstants::COMMAND_ADD_RF_IMPLEMENTATION.

◆ isEnabled()

bool AddRFImplementationCmd::isEnabled ( )
virtual

Returns true if the command should be enabled in the tool/menubar.

Returns
True if the command is enabled, false if not.

Implements GUICommand.

Definition at line 155 of file AddRFImplementationCmd.cc.

155 {
156
157 HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
158
159 if (manager == NULL) {
160 return false;
161 }
162
163 HDBBrowserWindow* browser = wxGetApp().mainFrame().browser();
164
165
166 if (browser->isRFArchitectureSelected()) {
167 return true;
168 } else if (browser->isRFEntrySelected()) {
169 HDB::RFEntry* entry = manager->rfByEntryID(browser->selectedRFEntry());
170 if (entry->hasArchitecture() && !entry->hasImplementation()) {
171 delete entry;
172 return true;
173 }
174 delete entry;
175 }
176
177 return false;
178}
virtual bool hasImplementation() const
Definition RFEntry.cc:74
virtual bool hasArchitecture() const
Definition RFEntry.cc:117

References HDB::RFEntry::hasArchitecture(), HDB::RFEntry::hasImplementation(), HDBBrowserWindow::isRFArchitectureSelected(), HDBBrowserWindow::isRFEntrySelected(), HDB::HDBManager::rfByEntryID(), and HDBBrowserWindow::selectedRFEntry().

Here is the call graph for this function:

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