xoreos  0.0.5
queueable.h
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 #ifndef GRAPHICS_QUEUEABLE_H
26 #define GRAPHICS_QUEUEABLE_H
27 
28 #include <list>
29 
30 #include "src/graphics/types.h"
31 
32 namespace Graphics {
33 
34 class Queueable {
35 public:
36  Queueable();
37  virtual ~Queueable();
38 
39  virtual bool operator<(const Queueable &q) const;
40 
41 protected:
42  bool isInQueue(QueueType queue) const {
43  return _isInQueue[queue];
44  }
45 
46  void addToQueue(QueueType queue);
47  void removeFromQueue(QueueType queue);
48 
49  void lockQueue(QueueType queue);
50  void unlockQueue(QueueType queue);
51  void sortQueue(QueueType queue);
52 
53 private:
55  std::list<Queueable *>::iterator _queueRef[kQueueMAX];
56 
57  void removeFromAll();
58  void kickedOut(QueueType queue);
59 
60  friend class QueueManager;
61 };
62 
63 } // End of namespace Graphics
64 
65 #endif // GRAPHICS_QUEUEABLE_H
The graphics queue manager.
Definition: queueman.h:41
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
Basic graphics types.
void lockQueue(QueueType queue)
Definition: queueable.cpp:67
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
void removeFromQueue(QueueType queue)
Definition: queueable.cpp:56
void sortQueue(QueueType queue)
Definition: queueable.cpp:75
bool isInQueue(QueueType queue) const
Definition: queueable.h:42