Foundation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
Foundation::RHI::RHIObjectPool< Base > Class Template Reference

Thread-safe type-erased handle dereference facility for RHI Objects. More...

#include <Details.hpp>

Public Member Functions

 RHIObjectPool (Core::Allocator *allocator)
 
template<typename U , typename... Args>
Handle CreateObject (Args &&... args)
 Creates specified RHIObject of derived type T and retrieves its handle.
 
void DestroyObject (Handle handle)
 Destroys the object associated with the given handle, and frees the handle for reuse.
 
void Destroy ()
 Destroys all objects in the pool.
 

Static Public Member Functions

template<typename U = Base>
static UGetObjectPtr (Handle handle) noexcept
 Retrieves the raw pointer to the object within the storage.
 

Private Types

using PointerType = Core::UniquePtr< Base >
 

Private Attributes

Core::AllocatormAllocator
 
Core::AtomicPool< PointerTypemPool
 

Detailed Description

template<typename Base = RHIObject>
class Foundation::RHI::RHIObjectPool< Base >

Thread-safe type-erased handle dereference facility for RHI Objects.

Member Typedef Documentation

◆ PointerType

template<typename Base = RHIObject>
using Foundation::RHI::RHIObjectPool< Base >::PointerType = Core::UniquePtr<Base>
private

Constructor & Destructor Documentation

◆ RHIObjectPool()

template<typename Base = RHIObject>
Foundation::RHI::RHIObjectPool< Base >::RHIObjectPool ( Core::Allocator allocator)
inline

Member Function Documentation

◆ CreateObject()

template<typename Base = RHIObject>
template<typename U , typename... Args>
Handle Foundation::RHI::RHIObjectPool< Base >::CreateObject ( Args &&...  args)
inline

Creates specified RHIObject of derived type T and retrieves its handle.

Returns
A handle to the newly created object.

◆ Destroy()

template<typename Base = RHIObject>
void Foundation::RHI::RHIObjectPool< Base >::Destroy ( )
inline

Destroys all objects in the pool.

◆ DestroyObject()

template<typename Base = RHIObject>
void Foundation::RHI::RHIObjectPool< Base >::DestroyObject ( Handle  handle)
inline

Destroys the object associated with the given handle, and frees the handle for reuse.

◆ GetObjectPtr()

template<typename Base = RHIObject>
template<typename U = Base>
static U * Foundation::RHI::RHIObjectPool< Base >::GetObjectPtr ( Handle  handle)
inlinestaticnoexcept

Retrieves the raw pointer to the object within the storage.

Template Parameters
UPointer type to cast to.
Returns
The raw pointer.

Member Data Documentation

◆ mAllocator

template<typename Base = RHIObject>
Core::Allocator* Foundation::RHI::RHIObjectPool< Base >::mAllocator
private

◆ mPool


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