OpenASIP  2.0
AddBusEntryCmd.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 AddBusEntryCmd.cc
26  *
27  * Implementation of AddBusEntryCmd class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include "AddBusEntryCmd.hh"
34 #include "WxConversion.hh"
35 #include "HDBEditorConstants.hh"
36 #include "HDBEditor.hh"
37 #include "HDBEditorMainFrame.hh"
38 #include "DBTypes.hh"
39 #include "HDBManager.hh"
40 #include "HDBBrowserWindow.hh"
41 
42 /**
43  * The Constructor.
44  */
46  GUICommand(HDBEditorConstants::COMMAND_NAME_ADD_BUS_ENTRY, NULL) {
47 }
48 
49 
50 /**
51  * The Destructor.
52  */
54 }
55 
56 /**
57  * Executes the command.
58  */
59 bool
61  HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
62 
63  if (manager == NULL) {
64  return false;
65  }
66 
67  RowID id = manager->addBusEntry();
68 
69  wxGetApp().mainFrame().update();
70  wxGetApp().mainFrame().browser()->selectBusEntry(id);
71 
72  return true;
73 }
74 
75 /**
76  * Returns name of the command icon file.
77  *
78  * @return Command icon file name.
79  */
80 std::string
82  return "";
83 }
84 
85 
86 /**
87  * Returns command identifier for this command.
88  *
89  * @return Command identifier of this command.
90  */
91 int
94 }
95 
96 
97 /**
98  * Creates and returns new instance of this command.
99  *
100  * @return Newly created instance of this command.
101  */
104  return new AddBusEntryCmd();
105 }
106 
107 
108 /**
109  * Returns true, if the command should be enabled in the menu/toolbar.
110  *
111  * @return True, if the command is enabled, false if not.
112  */
113 bool
115  HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
116 
117  if (manager == NULL) {
118  return false;
119  }
120 
121  return true;
122 }
123 
HDBBrowserWindow.hh
HDBEditor.hh
AddBusEntryCmd.hh
HDBEditorConstants.hh
AddBusEntryCmd::AddBusEntryCmd
AddBusEntryCmd()
Definition: AddBusEntryCmd.cc:45
AddBusEntryCmd::Do
virtual bool Do()
Definition: AddBusEntryCmd.cc:60
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
AddBusEntryCmd::id
virtual int id() const
Definition: AddBusEntryCmd.cc:92
AddBusEntryCmd::isEnabled
virtual bool isEnabled()
Definition: AddBusEntryCmd.cc:114
AddBusEntryCmd::icon
virtual std::string icon() const
Definition: AddBusEntryCmd.cc:81
DBTypes.hh
HDBEditorConstants::COMMAND_ADD_BUS_ENTRY
@ COMMAND_ADD_BUS_ENTRY
Definition: HDBEditorConstants.hh:55
GUICommand
Definition: GUICommand.hh:43
HDBEditorMainFrame.hh
AddBusEntryCmd::~AddBusEntryCmd
virtual ~AddBusEntryCmd()
Definition: AddBusEntryCmd.cc:53
HDB::HDBManager
Definition: HDBManager.hh:82
HDB::HDBManager::addBusEntry
RowID addBusEntry() const
Definition: HDBManager.cc:3393
AddBusEntryCmd
Definition: AddBusEntryCmd.hh:41
HDBEditorConstants
Definition: HDBEditorConstants.hh:42
WxConversion.hh
AddBusEntryCmd::create
virtual AddBusEntryCmd * create() const
Definition: AddBusEntryCmd.cc:103
HDBManager.hh