OpenASIP  2.0
VerifyMachineCmd.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 VerifyMachineCmd.cc
26  *
27  * Definition of VerifyMachineCmd 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 "VerifyMachineCmd.hh"
36 #include "ProDeConstants.hh"
37 #include "InformationDialog.hh"
38 #include "ProDe.hh"
39 #include "MDFDocument.hh"
40 #include "ValidateMachineDialog.hh"
41 
42 using std::string;
43 
44 /**
45  * The Constructor.
46  */
48  EditorCommand(ProDeConstants::CMD_NAME_VERIFY_MACHINE) {
49 
50 }
51 
52 
53 /**
54  * The Destructor.
55  */
57 
58 
59 /**
60  * Executes the command.
61  *
62  * @return True, if the command was succesfully executed, false otherwise.
63  */
64 bool
66 
67  wxString errorMessages;
68 
69  const TTAMachine::Machine* machine = dynamic_cast<MDFDocument*>(
70  view()->GetDocument())->getModel()->getMachine();
71 
73  dialog.ShowModal();
74 
75  return true;
76 
77 }
78 
79 
80 /**
81  * Returns id of this command.
82  */
83 int
86 }
87 
88 
89 /**
90  * Creates and returns a new instance of this command.
91  */
94  return new VerifyMachineCmd();
95 }
96 
97 
98 
99 /**
100  * Returns path to the command's icon file.
101  */
102 string
105 }
106 
107 
108 /**
109  * Returns short version of the command name.
110  */
111 string
114 }
115 
116 
117 /**
118  * Returns true when the command is executable, false when not.
119  *
120  * This command is executable when a document is open.
121  *
122  * @return True, if a document is open.
123  */
124 bool
126  wxDocManager* manager = wxGetApp().docManager();
127  if (manager->GetCurrentView() != NULL) {
128  return true;
129  }
130  return false;
131 }
VerifyMachineCmd::Do
virtual bool Do()
Definition: VerifyMachineCmd.cc:65
VerifyMachineCmd::create
virtual VerifyMachineCmd * create() const
Definition: VerifyMachineCmd.cc:93
VerifyMachineCmd::shortName
virtual std::string shortName() const
Definition: VerifyMachineCmd.cc:112
ProDe.hh
VerifyMachineCmd::isEnabled
virtual bool isEnabled()
Definition: VerifyMachineCmd.cc:125
MDFDocument.hh
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
ValidateMachineDialog
Definition: ValidateMachineDialog.hh:47
ProDeConstants::CMD_SNAME_VERIFY_MACHINE
static const std::string CMD_SNAME_VERIFY_MACHINE
Command name for the "Verify Machine" command.
Definition: ProDeConstants.hh:249
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
InformationDialog.hh
VerifyMachineCmd::icon
virtual std::string icon() const
Definition: VerifyMachineCmd.cc:103
MDFDocument
Definition: MDFDocument.hh:51
ProDeConstants.hh
VerifyMachineCmd::~VerifyMachineCmd
virtual ~VerifyMachineCmd()
Definition: VerifyMachineCmd.cc:56
VerifyMachineCmd.hh
EditorCommand
Definition: EditorCommand.hh:46
VerifyMachineCmd
Definition: VerifyMachineCmd.hh:42
VerifyMachineCmd::VerifyMachineCmd
VerifyMachineCmd()
Definition: VerifyMachineCmd.cc:47
ProDeConstants
Definition: ProDeConstants.hh:43
ValidateMachineDialog.hh
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
ProDeConstants::CMD_ICON_VERIFY_MACHINE
static const std::string CMD_ICON_VERIFY_MACHINE
Icon location for the "Verify Machine" command.
Definition: ProDeConstants.hh:348
VerifyMachineCmd::id
virtual int id() const
Definition: VerifyMachineCmd.cc:84
TTAMachine::Machine
Definition: Machine.hh:73
ProDeConstants::COMMAND_VERIFY_MACHINE
@ COMMAND_VERIFY_MACHINE
Definition: ProDeConstants.hh:457