5#include <Utility/Concurrent/TAtomicQuasiQueue.h>
6#include <Common/assertion.h>
16template<CWeakHandle Handle>
19 using Index =
typename Handle::IndexType;
20 using Generation =
typename Handle::GenerationType;
31 : m_handles(other.m_handles)
32 , m_nextNewIdx(other.m_nextNewIdx)
53 if(!m_handles.empty())
55 Handle handle = m_handles.front();
61 constexpr auto initialGeneration = Handle::nextGeneration(Handle::INVALID_GENERATION);
62 const Index newIdx = m_nextNewIdx++;
63 return Handle(newIdx, initialGeneration);
71 m_handles.push(handle);
79 swap(first.m_handles, second.m_handles);
80 swap(first.m_nextNewIdx, second.m_nextNewIdx);
84 std::queue<Handle> m_handles;
Sequential handle dispatcher meant for single-threaded use.
Definition THandleDispatcher.h:18
Handle HandleType
Definition THandleDispatcher.h:23
Handle dispatchOne()
Get one handle.
Definition THandleDispatcher.h:51
THandleDispatcher(THandleDispatcher &&other) noexcept
Definition THandleDispatcher.h:35
THandleDispatcher & operator=(THandleDispatcher rhs)
Definition THandleDispatcher.h:41
THandleDispatcher(const THandleDispatcher &other)
Definition THandleDispatcher.h:30
THandleDispatcher()
Definition THandleDispatcher.h:25
friend void swap(THandleDispatcher &first, THandleDispatcher &second) noexcept
Definition THandleDispatcher.h:74
void returnOne(const Handle &handle)
Recycle one handle.
Definition THandleDispatcher.h:68
Definition ph_editor.h:10