HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
hi::v1::id_factory< T > Class Template Reference

#include <hikogui/concurrency/id_factory.hpp>

Public Types

using value_type = T

Public Member Functions

 id_factory (id_factory const &)=delete
 id_factory (id_factory &&)=delete
id_factory & operator= (id_factory const &)=delete
id_factory & operator= (id_factory &&)=delete
value_type acquire () noexcept
 Get the next ID.
void release (value_type v) noexcept
 Release an ID for reuse.
value_type operator++ () noexcept

Detailed Description

template<std::unsigned_integral T>
class hi::v1::id_factory< T >

A factory for unique IDs.

This factory allows you to release an ID so that it may be reused at a later time.

Acquiring a new ID

Member Function Documentation

◆ acquire()

template<std::unsigned_integral T>
value_type hi::v1::id_factory< T >::acquire ( )
inlinenodiscardnoexcept

Get the next ID.

Note
This algorithm is wait-free.
Returns
A new ID, or a previously released ID.

◆ operator++()

template<std::unsigned_integral T>
value_type hi::v1::id_factory< T >::operator++ ( )
inlinenodiscardnoexcept
See also
acquire()

◆ release()

template<std::unsigned_integral T>
void hi::v1::id_factory< T >::release ( value_type v)
inlinenoexcept

Release an ID for reuse.

If you want to release from a real-time thread you may post this on the main thread.

Note
This algorithm is blocking.
Parameters
vThe ID to release

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