OpenASIP  2.0
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.

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.

113  {
114  return new AddCostFunctionPluginCmd();
115 }

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 
71  CostFunctionPlugin plugin(0, "", "", "", CostFunctionPlugin::COST_FU);
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 }

References HDB::HDBManager::addCostFunctionPlugin(), 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.

102  {
104 }

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:
AddCostFunctionPluginCmd::AddCostFunctionPluginCmd
AddCostFunctionPluginCmd()
Definition: AddCostFunctionPluginCmd.cc:49
HDB::HDBManager::addCostFunctionPlugin
RowID addCostFunctionPlugin(const CostFunctionPlugin &plugin) const
Definition: HDBManager.cc:626
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
CostFunctionPluginDialog
Definition: CostFunctionPluginDialog.hh:46
HDBEditorConstants::COMMAND_NAME_ADD_COST_PLUGIN
static const std::string COMMAND_NAME_ADD_COST_PLUGIN
Name of the add cost function plugin command.
Definition: HDBEditorConstants.hh:86
HDBEditorConstants::COMMAND_ADD_COST_PLUGIN
@ COMMAND_ADD_COST_PLUGIN
Definition: HDBEditorConstants.hh:57
HDB::HDBManager
Definition: HDBManager.hh:82
HDB::HDBManager::removeCostFunctionPlugin
virtual void removeCostFunctionPlugin(RowID pluginID) const
Definition: HDBManager.cc:684
GUICommand::GUICommand
GUICommand(std::string name, wxWindow *parent)
Definition: GUICommand.cc:42
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
HDB::CostFunctionPlugin
Definition: CostFunctionPlugin.hh:43