Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::TextureHandOutQueue< Item > Class Template Reference

The free items of one pool bucket, handed out in the order the most recent frame took them, whatever order they came back in, then those of earlier frames by recency. More...

#include "donner/svg/renderer/TextureHandOutQueue.h"

Public Member Functions

bool empty () const
 True when no item is queued.
size_t size () const
 Number of queued items.
void push (Item item, TextureHandOutStamp stamp)
 Queues item under stamp.
Item takeNext ()
 Removes and returns the item to hand out next. Requires a non-empty queue.
Item takeLast ()
 Removes and returns the item the queue would hand out last, the one to evict first. Requires a non-empty queue.
template<typename Consume>
void drain (Consume &&consume)
 Removes every item, passing each to consume.

Detailed Description

template<typename Item>
class donner::svg::TextureHandOutQueue< Item >

The free items of one pool bucket, handed out in the order the most recent frame took them, whatever order they came back in, then those of earlier frames by recency.

A frame that repeats the previous frame's acquisitions therefore gets back the same item for each one, which keeps caches keyed on item identity valid across unchanged frames. Items never handed out, and items whose stamp was dropped, carry a zero stamp: they go out after every item handed out, including those of the pool's first frame, in the order they were queued.

push, takeNext and takeLast each cost O(log n) and move the item a constant number of times, for in-order and out-of-order returns alike, so a bucket of many small textures costs no more per return than a bucket of a few.

Template Parameters
ItemMove-only or copyable item type, such as a texture handle.

Member Function Documentation

◆ drain()

template<typename Item>
template<typename Consume>
void donner::svg::TextureHandOutQueue< Item >::drain ( Consume && consume)
inline

Removes every item, passing each to consume.

Parameters
consumeCalled with each item as an rvalue.

◆ push()

template<typename Item>
void donner::svg::TextureHandOutQueue< Item >::push ( Item item,
TextureHandOutStamp stamp )
inline

Queues item under stamp.

Parameters
itemItem to queue; moved from.
stampWhen the pool last handed item out.

The documentation for this class was generated from the following file: