OpenASIP
2.0
src
procgen
HDBEditor
AddSocketEntryCmd.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 AddSocketEntryCmd.cc
26
*
27
* Implementation of AddSocketEntryCmd class.
28
*
29
* @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30
* @note rating: red
31
*/
32
33
#include "
AddSocketEntryCmd.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
AddSocketEntryCmd::AddSocketEntryCmd
() :
46
GUICommand
(
HDBEditorConstants
::COMMAND_NAME_ADD_SOCKET_ENTRY, NULL) {
47
}
48
49
50
/**
51
* The Destructor.
52
*/
53
AddSocketEntryCmd::~AddSocketEntryCmd
() {
54
}
55
56
/**
57
* Executes the command.
58
*/
59
bool
60
AddSocketEntryCmd::Do
() {
61
HDB::HDBManager
* manager = wxGetApp().mainFrame().hdbManager();
62
63
if
(manager == NULL) {
64
return
false
;
65
}
66
67
RowID
id
= manager->
addSocketEntry
();
68
69
wxGetApp().mainFrame().update();
70
wxGetApp().mainFrame().browser()->selectSocketEntry(
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
AddSocketEntryCmd::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
AddSocketEntryCmd::id
()
const
{
93
return
HDBEditorConstants::COMMAND_ADD_SOCKET_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
AddSocketEntryCmd
*
103
AddSocketEntryCmd::create
()
const
{
104
return
new
AddSocketEntryCmd
();
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
AddSocketEntryCmd::isEnabled
() {
115
HDB::HDBManager
* manager = wxGetApp().mainFrame().hdbManager();
116
117
if
(manager == NULL) {
118
return
false
;
119
}
120
121
return
true
;
122
}
123
AddSocketEntryCmd.hh
HDBBrowserWindow.hh
AddSocketEntryCmd::id
virtual int id() const
Definition:
AddSocketEntryCmd.cc:92
AddSocketEntryCmd
Definition:
AddSocketEntryCmd.hh:41
HDBEditor.hh
HDB::HDBManager::addSocketEntry
RowID addSocketEntry() const
Definition:
HDBManager.cc:3606
HDBEditorConstants.hh
RowID
int RowID
Type definition of row ID in relational databases.
Definition:
DBTypes.hh:37
AddSocketEntryCmd::create
virtual AddSocketEntryCmd * create() const
Definition:
AddSocketEntryCmd.cc:103
AddSocketEntryCmd::AddSocketEntryCmd
AddSocketEntryCmd()
Definition:
AddSocketEntryCmd.cc:45
DBTypes.hh
GUICommand
Definition:
GUICommand.hh:43
HDBEditorMainFrame.hh
HDB::HDBManager
Definition:
HDBManager.hh:82
AddSocketEntryCmd::icon
virtual std::string icon() const
Definition:
AddSocketEntryCmd.cc:81
AddSocketEntryCmd::Do
virtual bool Do()
Definition:
AddSocketEntryCmd.cc:60
HDBEditorConstants
Definition:
HDBEditorConstants.hh:42
WxConversion.hh
HDBEditorConstants::COMMAND_ADD_SOCKET_ENTRY
@ COMMAND_ADD_SOCKET_ENTRY
Definition:
HDBEditorConstants.hh:56
HDBManager.hh
AddSocketEntryCmd::~AddSocketEntryCmd
virtual ~AddSocketEntryCmd()
Definition:
AddSocketEntryCmd.cc:53
AddSocketEntryCmd::isEnabled
virtual bool isEnabled()
Definition:
AddSocketEntryCmd.cc:114
Generated by
1.8.17