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

#include <AddCostFunctionPluginCmd.hh>

Inheritance diagram for AddCostFunctionPluginCmd:
Inheritance graph
Collaboration diagram for AddCostFunctionPluginCmd:
Collaboration graph

Public Member Functions

 AddCostFunctionPluginCmd ()
 
virtual ~AddCostFunctionPluginCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual AddCostFunctionPluginCmdcreate () 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 a new cost function plugin to a HDB.

Definition at line 41 of file AddCostFunctionPluginCmd.hh.

Constructor & Destructor Documentation

◆ AddCostFunctionPluginCmd()

AddCostFunctionPluginCmd::AddCostFunctionPluginCmd ( )

The Constructor.

Definition at line 49 of file AddCostFunctionPluginCmd.cc.

49 :
51}
static const std::string COMMAND_NAME_ADD_COST_PLUGIN
Name of the add cost function plugin command.

Referenced by create().

◆ ~AddCostFunctionPluginCmd()

AddCostFunctionPluginCmd::~AddCostFunctionPluginCmd ( )
virtual

The Destructor.

Definition at line 57 of file AddCostFunctionPluginCmd.cc.

57 {
58}

Member Function Documentation

◆ create()

AddCostFunctionPluginCmd * AddCostFunctionPluginCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Returns
A new instance of this command.

Implements GUICommand.

Definition at line 113 of file AddCostFunctionPluginCmd.cc.

References AddCostFunctionPluginCmd().

Here is the call graph for this function:

◆ Do()

bool AddCostFunctionPluginCmd::Do ( )
virtual

Executes the command.

Implements GUICommand.

Definition at line 64 of file AddCostFunctionPluginCmd.cc.

64 {
65
66 HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
67 if (manager == NULL) {
68 return false;
69 }
70
72 RowID id = manager->addCostFunctionPlugin(plugin);
73 CostFunctionPluginDialog dialog(parentWindow(), -1, *manager, id);
74
75 if (dialog.ShowModal() == wxID_OK) {
76 wxGetApp().mainFrame().update();
77 wxGetApp().mainFrame().browser()->selectCostFunctionPlugin(id);
78 return true;
79 } else {
80 manager->removeCostFunctionPlugin(id);
81 return false;
82 }
83}
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
wxWindow * parentWindow() const
Definition GUICommand.cc:75
@ COST_FU
function unit cost estimator
RowID addCostFunctionPlugin(const CostFunctionPlugin &plugin) const
virtual void removeCostFunctionPlugin(RowID pluginID) const

References HDB::HDBManager::addCostFunctionPlugin(), HDB::CostFunctionPlugin::COST_FU, GUICommand::parentWindow(), and HDB::HDBManager::removeCostFunctionPlugin().

Here is the call graph for this function:

◆ icon()

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

Returns name of the command icon file.

Returns
Command icon file name.

Implements GUICommand.

Definition at line 91 of file AddCostFunctionPluginCmd.cc.

91 {
92 return "";
93}

◆ id()

int AddCostFunctionPluginCmd::id ( ) const
virtual

Returns the command identifier.

Returns
Command identifier for this command.

Implements GUICommand.

Definition at line 102 of file AddCostFunctionPluginCmd.cc.

References HDBEditorConstants::COMMAND_ADD_COST_PLUGIN.

◆ isEnabled()

bool AddCostFunctionPluginCmd::isEnabled ( )
virtual

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

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

Implements GUICommand.

Definition at line 124 of file AddCostFunctionPluginCmd.cc.

124 {
125
126 HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
127
128 if (manager == NULL) {
129 return false;
130 }
131 return true;
132}

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