jGL
|
Store elements in a priority ordering, with identities. More...
#include <priorityStore.h>
Classes | |
struct | Info |
Combine an id and a priority. More... | |
Public Member Functions | |
PriorityStore (uint64_t sizeHint=8) | |
Construct a new Priority Store with a reserved size. | |
virtual void | clear () |
virtual void | add (T s, ElementId id, Priority priority=0) |
Insert an element. | |
virtual void | remove (ElementId id) |
void | updatePriority (ElementId id, Priority newPriority) |
std::vector< std::pair< Info, T > > | vectorise (std::multimap< Priority, ElementId > &oids) |
Return a vector from overriding priorities. | |
T & | operator[] (ElementId id) |
std::vector< std::pair< Info, T > >::const_iterator | begin () const |
std::vector< std::pair< Info, T > >::const_iterator | end () const |
uint64_t | size () const |
bool | hasId (const ElementId id) const |
Protected Attributes | |
std::unordered_map< ElementId, std::pair< T, Priority > > | idToElement |
std::vector< std::pair< Info, T > > | cache |
Store elements in a priority ordering, with identities.
T | an element, wrapped in a std::shared_ptr. |
|
inline |
Construct a new Priority Store with a reserved size.
sizeHint | reserve this many elements. |
|
inlinevirtual |
Insert an element.
s | the element. |
id | its identity. |
priority | its priority. |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
Return a vector from overriding priorities.
oids | overriding priorities. |
|
protected |
|
protected |