xoreos  0.0.5
queueable.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include "src/common/system.h"
26 
27 #include "src/graphics/queueman.h"
28 #include "src/graphics/queueable.h"
29 
30 namespace Graphics {
31 
33  for (int i = 0; i < kQueueMAX; i++)
34  _isInQueue[i] = false;
35 }
36 
38  removeFromAll();
39 }
40 
41 bool Queueable::operator<(const Queueable &UNUSED(q)) const {
42  return false;
43 }
44 
46  QueueMan.lockQueue(queue);
47 
48  if (!_isInQueue[queue]) {
49  _queueRef[queue] = QueueMan.addToQueue(queue, *this);
50  _isInQueue[queue] = true;
51  }
52 
53  QueueMan.unlockQueue(queue);
54 }
55 
57  QueueMan.lockQueue(queue);
58 
59  if (_isInQueue[queue]) {
60  QueueMan.removeFromQueue(queue, _queueRef[queue]);
61  _isInQueue[queue] = false;
62  }
63 
64  QueueMan.unlockQueue(queue);
65 }
66 
68  QueueMan.lockQueue(queue);
69 }
70 
72  QueueMan.unlockQueue(queue);
73 }
74 
76  QueueMan.lockQueue(queue);
77  QueueMan.sortQueue(queue);
78  QueueMan.unlockQueue(queue);
79 }
80 
82  for (int i = 0; i < kQueueMAX; i++)
84 }
85 
87  QueueMan.lockQueue(queue);
88 
89  _isInQueue[queue] = false;
90 
91  QueueMan.unlockQueue(queue);
92 }
93 
94 } // End of namespace Graphics
For range checks.
Definition: types.h:86
virtual bool operator<(const Queueable &q) const
Definition: queueable.cpp:41
bool _isInQueue[kQueueMAX]
Definition: queueable.h:54
void addToQueue(QueueType queue)
Definition: queueable.cpp:45
#define QueueMan
Shortcut for accessing the graphics queue manager.
Definition: queueman.h:71
void lockQueue(QueueType queue)
Definition: queueable.cpp:67
#define UNUSED(x)
Definition: system.h:170
QueueType
Definition: types.h:71
void unlockQueue(QueueType queue)
Definition: queueable.cpp:71
virtual ~Queueable()
Definition: queueable.cpp:37
void kickedOut(QueueType queue)
Definition: queueable.cpp:86
std::list< Queueable * >::iterator _queueRef[kQueueMAX]
Definition: queueable.h:55
The graphics queue manager.
void removeFromQueue(QueueType queue)
Definition: queueable.cpp:56
An object that can be stored in a queue.
void sortQueue(QueueType queue)
Definition: queueable.cpp:75
Low-level detection of architecture/system properties.