OpenASIP
2.0
src
codesign
osal
OSEd
OSEdSimulateCmd.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 OSEdSimulateCmd.cc
26
*
27
* Declaration of OSEdSimulateCmd class.
28
*
29
* @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30
* @note rating: red
31
*/
32
33
#include "
OSEdSimulateCmd.hh
"
34
#include "
OperationContainer.hh
"
35
#include "
OSEd.hh
"
36
#include "
ErrorDialog.hh
"
37
#include "
WxConversion.hh
"
38
#include "
OSEdConstants.hh
"
39
#include "
SimulateDialog.hh
"
40
#include "
OperationBehaviorLoader.hh
"
41
#include "
OperationModule.hh
"
42
#include "
OSEdTreeView.hh
"
43
#include "
Operation.hh
"
44
45
using
std::string;
46
47
/**
48
* Constructor.
49
*/
50
OSEdSimulateCmd::OSEdSimulateCmd
() :
51
GUICommand
(
OSEdConstants
::CMD_NAME_SIMULATE, NULL) {
52
}
53
54
/**
55
* Destructor.
56
*/
57
OSEdSimulateCmd::~OSEdSimulateCmd
() {
58
}
59
60
/**
61
* Returns the id of the command.
62
*
63
* @return The id of the command.
64
*/
65
int
66
OSEdSimulateCmd::id
()
const
{
67
return
OSEdConstants::CMD_SIMULATE
;
68
}
69
70
/**
71
* Creates a new command.
72
*
73
* @return The created command.
74
*/
75
GUICommand
*
76
OSEdSimulateCmd::create
()
const
{
77
return
new
OSEdSimulateCmd
();
78
}
79
80
/**
81
* Executes the command.
82
*
83
* @return Always true.
84
*/
85
bool
86
OSEdSimulateCmd::Do
() {
87
88
OSEdMainFrame
* mainFrame = wxGetApp().mainFrame();
89
OSEdTreeView
* treeView = mainFrame->
treeView
();
90
Operation
* op = treeView->
selectedOperation
();
91
wxTreeItemId opId = treeView->
selectedOperationId
();
92
string
modName = treeView->
moduleOfOperation
(opId);
93
wxTreeItemId modId = treeView->
moduleIdOfOperation
(opId);
94
string
pathName = treeView->
pathOfModule
(modId);
95
96
//OperationModule& module = OperationContainer::module(pathName, modName);
97
98
SimulateDialog
* dialog =
99
new
SimulateDialog
(
parentWindow
(), op, pathName, modName);
100
dialog->ShowModal();
101
return
true
;
102
}
103
104
/**
105
* Returns true if command is enabled.
106
*
107
* Command is enabled, if selected operation has behavior module.
108
*
109
* @return True if command is enabled.
110
*/
111
bool
112
OSEdSimulateCmd::isEnabled
() {
113
OSEdTreeView
* treeView = wxGetApp().mainFrame()->treeView();
114
Operation
* op = treeView->
selectedOperation
();
115
116
if
(treeView->
isOperationSelected
() && op != NULL) {
117
return
op->
canBeSimulated
();
118
}
119
return
false
;
120
}
121
122
/**
123
* Return icon path.
124
*
125
* @return Empty string (icons not used).
126
*/
127
string
128
OSEdSimulateCmd::icon
()
const
{
129
return
""
;
130
}
OSEdTreeView::pathOfModule
std::string pathOfModule(wxTreeItemId id)
Definition:
OSEdTreeView.cc:431
OSEdTreeView::moduleIdOfOperation
wxTreeItemId moduleIdOfOperation(wxTreeItemId id)
Definition:
OSEdTreeView.cc:420
SimulateDialog
Definition:
SimulateDialog.hh:53
SimulateDialog.hh
OSEdSimulateCmd::Do
virtual bool Do()
Definition:
OSEdSimulateCmd.cc:86
OSEd.hh
Operation::canBeSimulated
virtual bool canBeSimulated() const
Definition:
Operation.cc:612
OperationBehaviorLoader.hh
OSEdMainFrame::treeView
OSEdTreeView * treeView() const
Definition:
OSEdMainFrame.cc:241
OSEdConstants.hh
OSEdConstants::CMD_SIMULATE
@ CMD_SIMULATE
Simulate command id.
Definition:
OSEdConstants.hh:100
OSEdSimulateCmd::id
virtual int id() const
Definition:
OSEdSimulateCmd.cc:66
GUICommand
Definition:
GUICommand.hh:43
OSEdSimulateCmd::create
virtual GUICommand * create() const
Definition:
OSEdSimulateCmd.cc:76
OSEdSimulateCmd.hh
OSEdTreeView
Definition:
OSEdTreeView.hh:54
ErrorDialog.hh
OSEdTreeView::moduleOfOperation
std::string moduleOfOperation(wxTreeItemId id)
Definition:
OSEdTreeView.cc:407
OSEdConstants
Definition:
OSEdConstants.hh:45
OSEdTreeView::isOperationSelected
bool isOperationSelected() const
Definition:
OSEdTreeView.cc:745
Operation.hh
OSEdTreeView::selectedOperation
Operation * selectedOperation()
Definition:
OSEdTreeView.cc:328
Operation
Definition:
Operation.hh:59
OSEdTreeView.hh
OSEdSimulateCmd::icon
virtual std::string icon() const
Definition:
OSEdSimulateCmd.cc:128
OSEdMainFrame
Definition:
OSEdMainFrame.hh:49
OSEdSimulateCmd::OSEdSimulateCmd
OSEdSimulateCmd()
Definition:
OSEdSimulateCmd.cc:50
OSEdTreeView::selectedOperationId
wxTreeItemId selectedOperationId()
Definition:
OSEdTreeView.cc:379
WxConversion.hh
OSEdSimulateCmd::~OSEdSimulateCmd
virtual ~OSEdSimulateCmd()
Definition:
OSEdSimulateCmd.cc:57
OSEdSimulateCmd::isEnabled
virtual bool isEnabled()
Definition:
OSEdSimulateCmd.cc:112
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition:
GUICommand.cc:75
OperationModule.hh
OperationContainer.hh
Generated by
1.8.17