Flutter Engine
The Flutter Engine
|
#include <SkTDPQueue.h>
Public Member Functions | |
SkTDPQueue () | |
SkTDPQueue (int reserve) | |
SkTDPQueue (SkTDPQueue &&)=default | |
SkTDPQueue & | operator= (SkTDPQueue &&)=default |
SkTDPQueue (const SkTDPQueue &)=delete | |
SkTDPQueue & | operator= (const SkTDPQueue &)=delete |
int | count () const |
const T & | peek () const |
T & | peek () |
void | pop () |
void | insert (T entry) |
void | remove (T entry) |
void | priorityDidChange (T entry) |
T | at (int i) const |
void | sort () |
This class implements a priority queue. T is the type of the elements in the queue. LESS is a function that compares two Ts and returns true if the first is higher priority than the second.
Optionally objects may know their index into the priority queue. The queue will update the index as the objects move through the queue. This is enabled by using a non-nullptr function for INDEX. When an INDEX function is provided random deletes from the queue are allowed using remove(). Additionally, the * priority is allowed to change as long as priorityDidChange() is called afterwards. In debug builds the index will be set to -1 before an element is removed from the queue.
Definition at line 33 of file SkTDPQueue.h.
|
inline |
Definition at line 35 of file SkTDPQueue.h.
|
inline |
Definition at line 36 of file SkTDPQueue.h.
|
default |
|
delete |
|
inline |
Gets the item at index i in the priority queue (for i < this->count()). at(0) is equivalent to peek(). Otherwise, there is no guarantee about ordering of elements in the queue.
Definition at line 110 of file SkTDPQueue.h.
|
inline |
Number of items in the queue.
Definition at line 45 of file SkTDPQueue.h.
|
inline |
Inserts a new item in the queue based on its priority.
Definition at line 69 of file SkTDPQueue.h.
|
delete |
|
default |
|
inline |
Definition at line 49 of file SkTDPQueue.h.
|
inline |
Gets the next item in the queue without popping it.
Definition at line 48 of file SkTDPQueue.h.
|
inline |
Removes the next item.
Definition at line 52 of file SkTDPQueue.h.
|
inline |
Notification that the priority of an entry has changed. This must be called after an item's priority is changed to maintain correct ordering. Changing the priority is only allowed if an INDEX function is provided.
Definition at line 99 of file SkTDPQueue.h.
|
inline |
Random access removal. This requires that the INDEX function is non-nullptr.
Definition at line 79 of file SkTDPQueue.h.
|
inline |
Sorts the queue into priority order. The queue is only guarenteed to remain in sorted order until any other operation, other than at(), is performed.
Definition at line 115 of file SkTDPQueue.h.