|
TachyonUI 1.1.0
High-performance UI for building tools.
|
Per-ID state kept between frames for the elements still built: an entry not written for kKeepFrames frames goes. More...
#include <gui_core/gui_recent_id_map.h>
Public Member Functions | |
| V & | operator[] (ID id) |
| The value for id, made when absent; kept for kKeepFrames more frames. | |
| void | Touch (ID id) |
| Keeps id's entry, when there is one, for kKeepFrames more frames. | |
| V * | Find (ID id) |
| The value for id, or null. Reading doesn't keep it. | |
| const V * | Find (ID id) const |
| void | Erase (ID id) |
| void | Clear () |
| size_t | Size () const |
| template<typename Visit> | |
| void | ForEach (Visit &&visit) |
| Calls visit(id, value) for each entry, in no particular order. | |
| template<typename MayDrop> | |
| void | EndFrame (MayDrop &&mayDrop) |
| Ends a frame. | |
| void | EndFrame () |
Static Public Attributes | |
| static constexpr uint32_t | kKeepFrames = 300 |
| static constexpr uint32_t | kSweepPeriod = 64 |
| frames between sweeps | |
Per-ID state kept between frames for the elements still built: an entry not written for kKeepFrames frames goes.
For state an immediate-mode control keeps by its ID (last frame's rect, a measured width), which would otherwise grow by one entry for every ID ever shown.
m_widths[id] = width; // written while the element is built: kept if (const int* w = m_widths.Find(id)) ... m_widths.EndFrame(); // once per frame
|
inline |
The value for id, made when absent; kept for kKeepFrames more frames.
|
inline |
Keeps id's entry, when there is one, for kKeepFrames more frames.
|
inline |
The value for id, or null. Reading doesn't keep it.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Calls visit(id, value) for each entry, in no particular order.
|
inline |
Ends a frame.
Every kSweepPeriod frames, drops the entries not written for kKeepFrames frames that mayDrop(id, value) agrees to (it can free what the value holds; return false to keep the entry anyway).
|
inline |
|
staticconstexpr |
|
staticconstexpr |
frames between sweeps