OpenASIP
2.0
src
procgen
ProDe
ImplementMachineCmd.cc
Go to the documentation of this file.
1
/*
2
Copyright (c) 2002-2009 Tampere University.
3
4
This file is part of TTA-Based Codesign Environment (TCE).
5
6
Permission is hereby granted, free of charge, to any person obtaining a
7
copy of this software and associated documentation files (the "Software"),
8
to deal in the Software without restriction, including without limitation
9
the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
and/or sell copies of the Software, and to permit persons to whom the
11
Software is furnished to do so, subject to the following conditions:
12
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
15
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
DEALINGS IN THE SOFTWARE.
23
*/
24
/**
25
* @file ImplementMachineCmd.cc
26
*
27
* Definition of ImplementMachineCmd class.
28
*
29
* @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30
* @note rating: red
31
*/
32
33
#include <wx/docview.h>
34
35
#include "
ProDe.hh
"
36
#include "
ImplementMachineCmd.hh
"
37
#include "
ProDeConstants.hh
"
38
#include "
MDFDocument.hh
"
39
#include "
ProcessorImplementationWindow.hh
"
40
#include "
MachineImplementation.hh
"
41
42
using
std::string;
43
44
/**
45
* The Constructor.
46
*/
47
ImplementMachineCmd::ImplementMachineCmd
():
48
EditorCommand
(
ProDeConstants
::CMD_NAME_IMPLEMENTATION) {
49
50
}
51
52
53
/**
54
* The Destructor.
55
*/
56
ImplementMachineCmd::~ImplementMachineCmd
() {}
57
58
59
/**
60
* Executes the command.
61
*
62
* @return True, if the command was succesfully executed, false otherwise.
63
*/
64
bool
65
ImplementMachineCmd::Do
() {
66
67
TTAMachine::Machine
*
machine
=
dynamic_cast<
MDFDocument
*
>
(
68
view
()->GetDocument())->getModel()->getMachine();
69
70
IDF::MachineImplementation
impl;
71
ProcessorImplementationWindow
dialog(
parentWindow
(), *
machine
, impl);
72
dialog.ShowModal();
73
74
return
true
;
75
76
}
77
78
79
/**
80
* Returns id of this command.
81
*/
82
int
83
ImplementMachineCmd::id
()
const
{
84
return
ProDeConstants::COMMAND_IMPLEMENTATION
;
85
}
86
87
88
/**
89
* Creates and returns a new instance of this command.
90
*/
91
ImplementMachineCmd
*
92
ImplementMachineCmd::create
()
const
{
93
return
new
ImplementMachineCmd
();
94
}
95
96
97
98
/**
99
* Returns path to the command's icon file.
100
*/
101
string
102
ImplementMachineCmd::icon
()
const
{
103
return
ProDeConstants::CMD_ICON_IMPLEMENTATION
;
104
}
105
106
107
/**
108
* Returns short version of the command name.
109
*/
110
string
111
ImplementMachineCmd::shortName
()
const
{
112
return
ProDeConstants::CMD_SNAME_IMPLEMENTATION
;
113
}
114
115
116
/**
117
* Returns true when the command is executable, false when not.
118
*
119
* This command is executable when a document is open.
120
*
121
* @return True, if a document is open.
122
*/
123
bool
124
ImplementMachineCmd::isEnabled
() {
125
wxDocManager* manager = wxGetApp().docManager();
126
if
(manager->GetCurrentView() != NULL) {
127
return
true
;
128
}
129
return
false
;
130
}
ProDe.hh
MDFDocument.hh
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition:
EstimatorCmdLineUI.cc:59
ImplementMachineCmd::~ImplementMachineCmd
virtual ~ImplementMachineCmd()
Definition:
ImplementMachineCmd.cc:56
ImplementMachineCmd::Do
virtual bool Do()
Definition:
ImplementMachineCmd.cc:65
ImplementMachineCmd::icon
virtual std::string icon() const
Definition:
ImplementMachineCmd.cc:102
ImplementMachineCmd::ImplementMachineCmd
ImplementMachineCmd()
Definition:
ImplementMachineCmd.cc:47
ImplementMachineCmd::shortName
virtual std::string shortName() const
Definition:
ImplementMachineCmd.cc:111
ProcessorImplementationWindow
Definition:
ProcessorImplementationWindow.hh:55
ImplementMachineCmd.hh
ProDeConstants::CMD_SNAME_IMPLEMENTATION
static const std::string CMD_SNAME_IMPLEMENTATION
Command name for the "Processor Implementation" command.
Definition:
ProDeConstants.hh:251
EditorCommand::view
wxView * view() const
Definition:
EditorCommand.cc:76
ProDeConstants::COMMAND_IMPLEMENTATION
@ COMMAND_IMPLEMENTATION
Definition:
ProDeConstants.hh:458
ImplementMachineCmd::id
virtual int id() const
Definition:
ImplementMachineCmd.cc:83
MDFDocument
Definition:
MDFDocument.hh:51
ProDeConstants.hh
ImplementMachineCmd
Definition:
ImplementMachineCmd.hh:43
ProcessorImplementationWindow.hh
ImplementMachineCmd::create
virtual ImplementMachineCmd * create() const
Definition:
ImplementMachineCmd.cc:92
ImplementMachineCmd::isEnabled
virtual bool isEnabled()
Definition:
ImplementMachineCmd.cc:124
ProDeConstants::CMD_ICON_IMPLEMENTATION
static const std::string CMD_ICON_IMPLEMENTATION
Icon location for the "Implementation" command.
Definition:
ProDeConstants.hh:350
EditorCommand
Definition:
EditorCommand.hh:46
ProDeConstants
Definition:
ProDeConstants.hh:43
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition:
GUICommand.cc:75
IDF::MachineImplementation
Definition:
MachineImplementation.hh:54
MachineImplementation.hh
TTAMachine::Machine
Definition:
Machine.hh:73
Generated by
1.8.17