OpenASIP 2.2
Loading...
Searching...
No Matches
RootEditPart.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 RootEditPart.cc
26 *
27 * Definition of RootEditPart class.
28 *
29 * @author Ari Metsähalme 2003 (ari.metsahalme-no.spam-tut.fi)
30 * @note rating: yellow
31 * @note reviewed Jul 13 2004 by vpj, ll, jn, am
32 */
33
34#include <set>
35
36#include "Application.hh"
37#include "RootEditPart.hh"
38#include "Figure.hh"
39
40using std::set;
41
42/**
43 * The Constructor.
44 */
45RootEditPart::RootEditPart(): EditPart(), contents_(NULL) {
46}
47
48/**
49 * The Destructor.
50 *
51 * Collects garbage from the contents EditPart and deletes it all.
52 */
56
57/**
58 * Sets the contents EditPart of the whole view.
59 *
60 * @param contents The new contents EditPart.
61 */
62void
68
69/**
70 * Collects trash from the contents EditPart and deletes it.
71 */
72void
74
75 if (contents_ != NULL) {
76
77 set<EditPart*> trashbag;
78 contents_->putGarbage(trashbag);
79
80 for (set<EditPart*>::iterator i = trashbag.begin();
81 i != trashbag.end(); i++) {
82 delete *i;
83 }
84
85 }
86 garbageCollected_ = true;
87}
bool garbageCollected_
Helper member to prevent improper deletion.
Definition EditPart.hh:102
void putGarbage(std::set< EditPart * > &trashbag)
Definition EditPart.cc:87
void collectTrash()
void setContents(EditPart *contents)
virtual ~RootEditPart()
EditPart * contents() const
EditPart * contents_
Contents EditPart which parents all EditParts in the View.