OpenASIP
2.0
src
procgen
HDBEditor
AddRFEntryCmd.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 AddRFEntryCmd.cc
26
*
27
* Implementation of AddRFEntryCmd class.
28
*
29
* @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30
* @note rating: red
31
*/
32
33
#include "
AddRFEntryCmd.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
*/
45
AddRFEntryCmd::AddRFEntryCmd
() :
46
GUICommand
(
HDBEditorConstants
::COMMAND_NAME_ADD_RF_ENTRY, NULL) {
47
}
48
49
50
/**
51
* The Destructor.
52
*/
53
AddRFEntryCmd::~AddRFEntryCmd
() {
54
}
55
56
/**
57
* Executes the command.
58
*/
59
bool
60
AddRFEntryCmd::Do
() {
61
HDB::HDBManager
* manager = wxGetApp().mainFrame().hdbManager();
62
63
if
(manager == NULL) {
64
return
false
;
65
}
66
67
RowID
id
= manager->
addRFEntry
();
68
69
wxGetApp().mainFrame().update();
70
wxGetApp().mainFrame().browser()->selectRFEntry(
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
81
AddRFEntryCmd::icon
()
const
{
82
return
""
;
83
}
84
85
86
/**
87
* Returns command identifier for this command.
88
*
89
* @return Command identifier of this command.
90
*/
91
int
92
AddRFEntryCmd::id
()
const
{
93
return
HDBEditorConstants::COMMAND_ADD_RF_ENTRY
;
94
}
95
96
97
/**
98
* Creates and returns new instance of this command.
99
*
100
* @return Newly created instance of this command.
101
*/
102
AddRFEntryCmd
*
103
AddRFEntryCmd::create
()
const
{
104
return
new
AddRFEntryCmd
();
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
114
AddRFEntryCmd::isEnabled
() {
115
HDB::HDBManager
* manager = wxGetApp().mainFrame().hdbManager();
116
117
if
(manager == NULL) {
118
return
false
;
119
}
120
121
return
true
;
122
}
123
AddRFEntryCmd::~AddRFEntryCmd
virtual ~AddRFEntryCmd()
Definition:
AddRFEntryCmd.cc:53
AddRFEntryCmd::create
virtual AddRFEntryCmd * create() const
Definition:
AddRFEntryCmd.cc:103
HDBBrowserWindow.hh
HDBEditor.hh
HDBEditorConstants::COMMAND_ADD_RF_ENTRY
@ COMMAND_ADD_RF_ENTRY
Definition:
HDBEditorConstants.hh:54
HDBEditorConstants.hh
RowID
int RowID
Type definition of row ID in relational databases.
Definition:
DBTypes.hh:37
AddRFEntryCmd::id
virtual int id() const
Definition:
AddRFEntryCmd.cc:92
HDB::HDBManager::addRFEntry
RowID addRFEntry() const
Definition:
HDBManager.cc:1557
AddRFEntryCmd::isEnabled
virtual bool isEnabled()
Definition:
AddRFEntryCmd.cc:114
DBTypes.hh
GUICommand
Definition:
GUICommand.hh:43
AddRFEntryCmd::AddRFEntryCmd
AddRFEntryCmd()
Definition:
AddRFEntryCmd.cc:45
HDBEditorMainFrame.hh
AddRFEntryCmd::Do
virtual bool Do()
Definition:
AddRFEntryCmd.cc:60
AddRFEntryCmd::icon
virtual std::string icon() const
Definition:
AddRFEntryCmd.cc:81
HDB::HDBManager
Definition:
HDBManager.hh:82
AddRFEntryCmd.hh
HDBEditorConstants
Definition:
HDBEditorConstants.hh:42
WxConversion.hh
AddRFEntryCmd
Definition:
AddRFEntryCmd.hh:41
HDBManager.hh
Generated by
1.8.17