OpenASIP 2.2
Loading...
Searching...
No Matches
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"
41#include "OperationModule.hh"
42#include "OSEdTreeView.hh"
43#include "Operation.hh"
44
45using std::string;
46
47/**
48 * Constructor.
49 */
51 GUICommand(OSEdConstants::CMD_NAME_SIMULATE, NULL) {
52}
53
54/**
55 * Destructor.
56 */
59
60/**
61 * Returns the id of the command.
62 *
63 * @return The id of the command.
64 */
65int
69
70/**
71 * Creates a new command.
72 *
73 * @return The created command.
74 */
77 return new OSEdSimulateCmd();
78}
79
80/**
81 * Executes the command.
82 *
83 * @return Always true.
84 */
85bool
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 */
111bool
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 */
127string
129 return "";
130}
wxWindow * parentWindow() const
Definition GUICommand.cc:75
@ CMD_SIMULATE
Simulate command id.
OSEdTreeView * treeView() const
virtual ~OSEdSimulateCmd()
virtual bool isEnabled()
virtual std::string icon() const
virtual int id() const
virtual GUICommand * create() const
virtual bool Do()
std::string pathOfModule(wxTreeItemId id)
bool isOperationSelected() const
wxTreeItemId selectedOperationId()
Operation * selectedOperation()
wxTreeItemId moduleIdOfOperation(wxTreeItemId id)
std::string moduleOfOperation(wxTreeItemId id)
virtual bool canBeSimulated() const
Definition Operation.cc:612