]>
Dogcows Code - chaz/openbox/blob - otk/timerqueue.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 #ifndef __timerqueue_hh
3 #define __timerqueue_hh
15 template <class _Tp
, class _Sequence
, class _Compare
>
16 class _timer_queue
: protected std::priority_queue
<_Tp
, _Sequence
, _Compare
> {
18 typedef std::priority_queue
<_Tp
, _Sequence
, _Compare
> _Base
;
20 _timer_queue(): _Base() {}
23 void release(const _Tp
& value
) {
24 c
.erase(std::remove(c
.begin(), c
.end(), value
), c
.end());
25 // after removing the item we need to make the heap again
26 std::make_heap(c
.begin(), c
.end(), comp
);
28 bool empty() const { return _Base::empty(); }
29 size_t size() const { return _Base::size(); }
30 void push(const _Tp
& value
) { _Base::push(value
); }
31 void pop() { _Base::pop(); }
32 const _Tp
& top() const { return _Base::top(); }
35 _timer_queue(const _timer_queue
&) {}
36 _timer_queue
& operator=(const _timer_queue
&) {}
39 struct TimerLessThan
{
40 bool operator()(const OBTimer
* const l
, const OBTimer
* const r
) const {
45 typedef _timer_queue
<OBTimer
*,
46 std::vector
<OBTimer
*>, TimerLessThan
> TimerQueue
;
50 #endif // DOXYGEN_IGNORE
52 #endif // __timerqueue_hh
This page took 0.039315 seconds and 4 git commands to generate.