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

#include <BlocksConnectICCmd.hh>

Inheritance diagram for BlocksConnectICCmd:
Inheritance graph
Collaboration diagram for BlocksConnectICCmd:
Collaboration graph

Public Member Functions

 BlocksConnectICCmd ()
 
virtual ~BlocksConnectICCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual BlocksConnectICCmdcreate () 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 calling BlocksConnectIC explorer plugin.

Definition at line 41 of file BlocksConnectICCmd.hh.

Constructor & Destructor Documentation

◆ BlocksConnectICCmd()

BlocksConnectICCmd::BlocksConnectICCmd ( )

Definition at line 50 of file BlocksConnectICCmd.cc.

static const std::string CMD_NAME_BLOCKS_CONNECT_IC
Command name for the "Blcoks Connect IC" command.

Referenced by create().

◆ ~BlocksConnectICCmd()

BlocksConnectICCmd::~BlocksConnectICCmd ( )
virtual

Definition at line 53 of file BlocksConnectICCmd.cc.

53{}

Member Function Documentation

◆ create()

BlocksConnectICCmd * BlocksConnectICCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Implements GUICommand.

Definition at line 119 of file BlocksConnectICCmd.cc.

119 {
120 return new BlocksConnectICCmd();
121}

References BlocksConnectICCmd().

Here is the call graph for this function:

◆ Do()

bool BlocksConnectICCmd::Do ( )
virtual

Executes the command.

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

Implements GUICommand.

Definition at line 61 of file BlocksConnectICCmd.cc.

61 {
62 assert(view() != NULL);
63
65 dynamic_cast<MDFDocument*>(view()->GetDocument())
66 ->getModel()
67 ->getMachine();
68
69 Model* model =
70 dynamic_cast<MDFDocument*>(view()->GetDocument())->getModel();
71
72 model->pushToStack();
73
74 // open up a temporary dsdb
75 const std::string dsdbFile = "tmp.dsdb";
77 DSDBManager* dsdb = DSDBManager::createNew(dsdbFile);
78 RowID archID = dsdb->addArchitecture(*machine);
79
81 RowID confID = dsdb->addConfiguration(confIn);
82
83 // load BlocksConnectIC explorer plugin
84 DesignSpaceExplorer explorer;
86 explorer.loadExplorerPlugin("BlocksConnectIC", dsdb);
87 plugin->setDSDB(*dsdb);
88
89 try {
90 std::vector<RowID> result = plugin->explore(confID, 0);
91 // store the new machine
92 TTAMachine::Machine& newMachine =
93 *dsdb->architecture(confID + result.size());
94 machine->copyFromMachine(newMachine);
95 } catch (Exception const& e) {
96 std::cerr << "Could not create Blocks Connect IC" << std::endl;
98 model->popFromStack();
99 return false;
100 }
102 model->notifyObservers();
103
104 return true;
105}
#define assert(condition)
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
#define ILLEGAL_ROW_ID
TTAMachine::Machine * machine
the architecture definition of the estimated processor
RowID addArchitecture(const TTAMachine::Machine &mom)
TTAMachine::Machine * architecture(RowID id) const
static DSDBManager * createNew(const std::string &file)
RowID addConfiguration(const MachineConfiguration &conf)
virtual std::vector< RowID > explore(const RowID &startPointConfigurationID, const unsigned int &maxIter=0)
virtual void setDSDB(DSDBManager &dsdb)
static DesignSpaceExplorerPlugin * loadExplorerPlugin(const std::string &pluginName, DSDBManager *dsdb=NULL)
wxView * view() const
static bool removeFileOrDirectory(const std::string &path)
Definition Model.hh:50
void pushToStack()
Definition Model.cc:167
void notifyObservers(bool modified=true)
Definition Model.cc:152
void popFromStack(bool modified=false)
Definition Model.cc:195
virtual void copyFromMachine(Machine &machine)
Definition Machine.cc:884

References DSDBManager::addArchitecture(), DSDBManager::addConfiguration(), DSDBManager::architecture(), assert, TTAMachine::Machine::copyFromMachine(), DSDBManager::createNew(), DesignSpaceExplorerPlugin::explore(), ILLEGAL_ROW_ID, DesignSpaceExplorer::loadExplorerPlugin(), machine, Model::notifyObservers(), Model::popFromStack(), Model::pushToStack(), FileSystem::removeFileOrDirectory(), DesignSpaceExplorer::setDSDB(), and EditorCommand::view().

Here is the call graph for this function:

◆ id()

int BlocksConnectICCmd::id ( ) const
virtual

Returns id of this command.

Implements GUICommand.

Definition at line 111 of file BlocksConnectICCmd.cc.

References ProDeConstants::COMMAND_BLOCKS_CONNECT_IC.

◆ isEnabled()

bool BlocksConnectICCmd::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 139 of file BlocksConnectICCmd.cc.

139 {
140 wxDocManager* manager = wxGetApp().docManager();
141 wxView* view = manager->GetCurrentView();
142
143 if (view == NULL) {
144 return false;
145 }
146
147 Model* model =
148 dynamic_cast<MDFDocument*>(view->GetDocument())->getModel();
149
150 if (model == NULL) {
151 return false;
152 }
153 return true;
154}

References EditorCommand::view().

Here is the call graph for this function:

◆ shortName()

std::string BlocksConnectICCmd::shortName ( ) const
virtual

Returns short version of the command name.

Reimplemented from GUICommand.

Definition at line 127 of file BlocksConnectICCmd.cc.

127 {
129}
static const std::string CMD_SNAME_BLOCKS_CONNECT_IC
Command name for the "Blocks Connect IC" command.

References ProDeConstants::CMD_SNAME_BLOCKS_CONNECT_IC.


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