OpenASIP  2.0
Public Member Functions | List of all members
FullyConnectBussesCmd Class Reference

#include <FullyConnectBussesCmd.hh>

Inheritance diagram for FullyConnectBussesCmd:
Inheritance graph
Collaboration diagram for FullyConnectBussesCmd:
Collaboration graph

Public Member Functions

 FullyConnectBussesCmd ()
 
virtual ~FullyConnectBussesCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual FullyConnectBussesCmdcreate () const
 
virtual bool isEnabled ()
 
virtual std::string shortName () const
 
- Public Member Functions inherited from EditorCommand
 EditorCommand (std::string name, wxWindow *parent=NULL)
 
virtual ~EditorCommand ()
 
void setView (wxView *view)
 
wxView * view () const
 
virtual std::string icon () const
 
- Public Member Functions inherited from GUICommand
 GUICommand (std::string name, wxWindow *parent)
 
virtual ~GUICommand ()
 
virtual bool isChecked () const
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Detailed Description

Command for connecting all sockets to all busses.

Definition at line 49 of file FullyConnectBussesCmd.hh.

Constructor & Destructor Documentation

◆ FullyConnectBussesCmd()

FullyConnectBussesCmd::FullyConnectBussesCmd ( )

The Constructor.

Definition at line 60 of file FullyConnectBussesCmd.cc.

Referenced by create().

◆ ~FullyConnectBussesCmd()

FullyConnectBussesCmd::~FullyConnectBussesCmd ( )
virtual

The Destructor.

Definition at line 68 of file FullyConnectBussesCmd.cc.

68 {}

Member Function Documentation

◆ create()

FullyConnectBussesCmd * FullyConnectBussesCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Implements GUICommand.

Definition at line 108 of file FullyConnectBussesCmd.cc.

108  {
109  return new FullyConnectBussesCmd();
110 }

References FullyConnectBussesCmd().

Here is the call graph for this function:

◆ Do()

bool FullyConnectBussesCmd::Do ( )
virtual

Executes the command.

Returns
True, if the command was succesfully executed, false otherwise.

Implements GUICommand.

Definition at line 77 of file FullyConnectBussesCmd.cc.

77  {
78 
79  assert(view() != NULL);
80 
81  Model* model = dynamic_cast<MDFDocument*>(
82  view()->GetDocument())->getModel();
83 
84  model->pushToStack();
85 
86  Machine& machine = *model->getMachine();
87 
88  FullyConnectedCheck checker;
89  checker.fix(machine);
90 
91  model->notifyObservers();
92  return true;
93 }

References assert, FullyConnectedCheck::fix(), Model::getMachine(), machine, Model::notifyObservers(), Model::pushToStack(), and EditorCommand::view().

Here is the call graph for this function:

◆ id()

int FullyConnectBussesCmd::id ( ) const
virtual

Returns id of this command.

Implements GUICommand.

Definition at line 99 of file FullyConnectBussesCmd.cc.

99  {
101 }

References ProDeConstants::COMMAND_FULLY_CONNECT_BUSSES.

◆ isEnabled()

bool FullyConnectBussesCmd::isEnabled ( )
virtual

Returns true when the command is executable, false when not.

This command is executable when a document is open.

Returns
True, if a document is open.

Reimplemented from EditorCommand.

Definition at line 130 of file FullyConnectBussesCmd.cc.

130  {
131 
132  wxDocManager* manager = wxGetApp().docManager();
133  wxView* view = manager->GetCurrentView();
134 
135  if (view == NULL) {
136  return false;
137  }
138 
139  Model* model = dynamic_cast<MDFDocument*>(
140  view->GetDocument())->getModel();
141 
142  if (model == NULL) {
143  return false;
144  }
145 
146  FullyConnectedCheck checker;
147  MachineCheckResults results;
148  if (!checker.check(*model->getMachine(), results)) {
149  return checker.canFix(*model->getMachine());
150  } else {
151  return false;
152  }
153 }

References FullyConnectedCheck::canFix(), FullyConnectedCheck::check(), Model::getMachine(), and EditorCommand::view().

Here is the call graph for this function:

◆ shortName()

string FullyConnectBussesCmd::shortName ( ) const
virtual

Returns short version of the command name.

Reimplemented from GUICommand.

Definition at line 117 of file FullyConnectBussesCmd.cc.

117  {
119 }

References ProDeConstants::CMD_SNAME_FULLY_CONNECT_BUSSES.


The documentation for this class was generated from the following files:
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
FullyConnectedCheck::canFix
virtual bool canFix(const TTAMachine::Machine &mach) const
Definition: FullyConnectedCheck.cc:78
Model::pushToStack
void pushToStack()
Definition: Model.cc:167
EditorCommand::EditorCommand
EditorCommand(std::string name, wxWindow *parent=NULL)
Definition: EditorCommand.cc:42
FullyConnectedCheck::fix
virtual std::string fix(TTAMachine::Machine &mach) const
Definition: FullyConnectedCheck.cc:267
Model::notifyObservers
void notifyObservers(bool modified=true)
Definition: Model.cc:152
assert
#define assert(condition)
Definition: Application.hh:86
ProDeConstants::CMD_SNAME_FULLY_CONNECT_BUSSES
static const std::string CMD_SNAME_FULLY_CONNECT_BUSSES
Command name for the "Fully connect busses" command.
Definition: ProDeConstants.hh:243
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
ProDeConstants::COMMAND_FULLY_CONNECT_BUSSES
@ COMMAND_FULLY_CONNECT_BUSSES
Definition: ProDeConstants.hh:454
MachineCheckResults
Definition: MachineCheckResults.hh:46
MDFDocument
Definition: MDFDocument.hh:51
FullyConnectBussesCmd::FullyConnectBussesCmd
FullyConnectBussesCmd()
Definition: FullyConnectBussesCmd.cc:60
FullyConnectedCheck::check
virtual bool check(const TTAMachine::Machine &mach) const
Definition: FullyConnectedCheck.cc:99
ProDeConstants::CMD_NAME_FULLY_CONNECT_BUSSES
static const std::string CMD_NAME_FULLY_CONNECT_BUSSES
Command name for the "Fully connect busses" command.
Definition: ProDeConstants.hh:147
Model
Definition: Model.hh:50
FullyConnectedCheck
Definition: FullyConnectedCheck.hh:51
Model::getMachine
TTAMachine::Machine * getMachine()
Definition: Model.cc:88
TTAMachine::Machine
Definition: Machine.hh:73