Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QFreeList< T, ConstantsType > Class Template Reference

#include <qfreelist_p.h>

Collaboration diagram for QFreeList< T, ConstantsType >:

Public Member Functions

constexpr QFreeList ()
 ~QFreeList ()
ConstReferenceType at (int x) const
ReferenceType operator[] (int x)
int next ()
void release (int id)

Detailed Description

template<typename T, typename ConstantsType = QFreeListDefaultConstants>
class QFreeList< T, ConstantsType >

This is a generic implementation of a lock-free free list. Use next() to get the next free entry in the list, and release(id) when done with the id.

This version is templated and allows having a payload of type T which can be accessed using the id returned by next(). The payload is allocated and deallocated automatically by the free list, but NOT when calling next()/release(). Initialization should be done by code needing it after next() returns. Likewise, cleanup() should happen before calling release(). It is possible to have use 'void' as the payload type, in which case the free list only contains indexes to the next free entry.

The ConstantsType type defaults to QFreeListDefaultConstants above. You can define your custom ConstantsType, see above for details on what needs to be available.

Definition at line 113 of file qfreelist_p.h.

Constructor & Destructor Documentation

◆ QFreeList()

template<typename T, typename ConstantsType>
QFreeList< T, ConstantsType >::QFreeList ( )
inlineconstexpr

Definition at line 174 of file qfreelist_p.h.

◆ ~QFreeList()

template<typename T, typename ConstantsType>
QFreeList< T, ConstantsType >::~QFreeList ( )
inline

Definition at line 181 of file qfreelist_p.h.

Member Function Documentation

◆ at()

template<typename T, typename ConstantsType>
QFreeList< T, ConstantsType >::ConstReferenceType QFreeList< T, ConstantsType >::at ( int x) const
inline

Definition at line 188 of file qfreelist_p.h.

◆ next()

template<typename T, typename ConstantsType>
int QFreeList< T, ConstantsType >::next ( )
inline

Definition at line 202 of file qfreelist_p.h.

◆ operator[]()

template<typename T, typename ConstantsType>
QFreeList< T, ConstantsType >::ReferenceType QFreeList< T, ConstantsType >::operator[] ( int x)
inline

Definition at line 195 of file qfreelist_p.h.

◆ release()

template<typename T, typename ConstantsType>
void QFreeList< T, ConstantsType >::release ( int id)
inline

Definition at line 233 of file qfreelist_p.h.


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