Minor changes here and there.
[aesalon.git] / src / artisan / gviewport / Data.cpp
blob97fdc7a95563a76aa59583854c04b23909a8b839
1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file src/artisan/gviewport/Data.cpp
8 */
10 #include <QAtomicInt>
12 #include "artisan/gviewport/Data.h"
13 #include "artisan/gviewport/Object.h"
15 namespace Artisan {
16 namespace GViewport {
18 void Data::startReading() {
19 m_treeLock.lockForRead();
22 void Data::stopReading() {
23 m_treeLock.unlock();
26 void Data::startWriting() {
27 m_treeLock.lockForWrite();
30 void Data::stopWriting() {
31 m_treeLock.unlock();
34 void Data::addObject(Object *object) {
35 startWriting();
36 m_tree.insert(object->bound().toTreeBound(), object);
37 stopWriting();
40 void Data::removeObject(Object *object) {
41 startWriting();
42 m_tree.remove(object->bound().toTreeBound(), object);
43 stopWriting();
46 } // namespace GViewport
47 } // namespace Artisan