OpenASIP 2.2
Loading...
Searching...
No Matches
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 */
46 GUICommand(HDBEditorConstants::COMMAND_NAME_ADD_SOCKET_ENTRY, NULL) {
47}
48
49
50/**
51 * The Destructor.
52 */
55
56/**
57 * Executes the command.
58 */
59bool
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 */
80std::string
82 return "";
83}
84
85
86/**
87 * Returns command identifier for this command.
88 *
89 * @return Command identifier of this command.
90 */
91int
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 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 */
113bool
115 HDB::HDBManager* manager = wxGetApp().mainFrame().hdbManager();
116
117 if (manager == NULL) {
118 return false;
119 }
120
121 return true;
122}
123
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
virtual AddSocketEntryCmd * create() const
virtual int id() const
virtual bool isEnabled()
virtual std::string icon() const
RowID addSocketEntry() const