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

#include <SetRFArchitectureCmd.hh>

Inheritance diagram for SetRFArchitectureCmd:
Inheritance graph
Collaboration diagram for SetRFArchitectureCmd:
Collaboration graph

Public Member Functions

 SetRFArchitectureCmd ()
 
virtual ~SetRFArchitectureCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual SetRFArchitectureCmdcreate () 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 setting architecture of a RFEntry.

Definition at line 41 of file SetRFArchitectureCmd.hh.

Constructor & Destructor Documentation

◆ SetRFArchitectureCmd()

SetRFArchitectureCmd::SetRFArchitectureCmd ( )

The Constructor.

Definition at line 48 of file SetRFArchitectureCmd.cc.

48 :
50}
static const std::string COMMAND_NAME_SET_RF_ARCH
Name of the set rf architecture command.

Referenced by create().

◆ ~SetRFArchitectureCmd()

SetRFArchitectureCmd::~SetRFArchitectureCmd ( )
virtual

The Destructor.

Definition at line 56 of file SetRFArchitectureCmd.cc.

56 {
57}

Member Function Documentation

◆ create()

SetRFArchitectureCmd * SetRFArchitectureCmd::create ( ) const
virtual

Creates and returns a new instance of the command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 132 of file SetRFArchitectureCmd.cc.

132 {
133 return new SetRFArchitectureCmd();
134}

References SetRFArchitectureCmd().

Here is the call graph for this function:

◆ Do()

bool SetRFArchitectureCmd::Do ( )
virtual

Executes the command.

Implements GUICommand.

Definition at line 63 of file SetRFArchitectureCmd.cc.

63 {
64
65 HDBManager* manager = wxGetApp().mainFrame().hdbManager();
66
67 if (manager == NULL) {
68 return false;
69 }
70
71 const RFEntry* entry = manager->rfByID(
72 wxGetApp().mainFrame().browser()->selectedRFEntry());
73
74 wxString rfs[1000];
75 const std::set<RowID> rfIDs = manager->rfArchitectureIDs();
76 std::set<RowID>::iterator iter = rfIDs.begin();
77 int i = 0;
78 for (;iter != rfIDs.end(); iter++) {
79 rfs[i] = WxConversion::toWxString(*iter);
80 i++;
81 }
82
83 wxSingleChoiceDialog choicer(
84 parentWindow(), _T("Choose Architecture"), _T("Choose Architecture"),
85 i, rfs);
86
87 if (choicer.ShowModal() != wxID_OK) {
88 return false;
89 }
90
91
92 std::string archID = WxConversion::toString(choicer.GetStringSelection());
93 RowID rowID = Conversion::toInt(archID);
94 manager->unsetArchitectureForRF(entry->id());
95 manager->setArchitectureForRF(entry->id(), rowID);
96
97 wxGetApp().mainFrame().update();
98 wxGetApp().mainFrame().browser()->selectRFEntry(entry->id());
99
100 return true;
101}
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
static int toInt(const T &source)
wxWindow * parentWindow() const
Definition GUICommand.cc:75
RowID id() const
Definition HDBEntry.cc:85
std::set< RowID > rfArchitectureIDs() const
void setArchitectureForRF(RowID rfID, RowID archID) const
void unsetArchitectureForRF(RowID rfID) const
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)

References HDB::HDBEntry::id(), GUICommand::parentWindow(), HDB::HDBManager::rfArchitectureIDs(), HDB::HDBManager::setArchitectureForRF(), Conversion::toInt(), WxConversion::toString(), WxConversion::toWxString(), and HDB::HDBManager::unsetArchitectureForRF().

Here is the call graph for this function:

◆ icon()

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

Returns name of the command icon file.

Returns
Command icon file name.

Implements GUICommand.

Definition at line 109 of file SetRFArchitectureCmd.cc.

109 {
110 return "";
111
112}

◆ id()

int SetRFArchitectureCmd::id ( ) const
virtual

Returns the command id.

Returns
Command identifier for this command.

Implements GUICommand.

Definition at line 121 of file SetRFArchitectureCmd.cc.

References HDBEditorConstants::COMMAND_SET_RF_ARCH.

◆ isEnabled()

bool SetRFArchitectureCmd::isEnabled ( )
virtual

Returns true if the command should be enabled in the menu/toolbar.

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

Implements GUICommand.

Definition at line 142 of file SetRFArchitectureCmd.cc.

142 {
143 HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
144
145 if (manager == NULL) {
146 return false;
147 }
148
149 if (!wxGetApp().mainFrame().browser()->isRFEntrySelected()) {
150 return false;
151 }
152 return true;
153}

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