UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TMediaObjectPool< ObjectType, ObjectAllocator > Class Template Reference

#include <MediaObjectPool.h>

Public Member Functions

 TMediaObjectPool (ObjectAllocator *ObjectAllocatorInstance=nullptr)
 
 TMediaObjectPool (uint32 NumReserve)
 
ObjectType * Acquire (bool bAlloc=true)
 
TSharedRef< ObjectType, ESPMode::ThreadSafeAcquireShared ()
 
TSharedPtr< ObjectType, ESPMode::ThreadSafeAcquireShared (bool bAlloc)
 
int32 Num () const
 
TSharedRef< ObjectType, ESPMode::ThreadSafeToShared (ObjectType *Object)
 
void Release (ObjectType *Object)
 
void Reset (uint32 NumObjects=0)
 
void Tick ()
 

Detailed Description

template<typename ObjectType, typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
class TMediaObjectPool< ObjectType, ObjectAllocator >

Template for media object pools.

Poolable objects are required to implement the IMediaPoolable interface.

Parameters
ObjectTypeThe type of objects managed by this pool.

Constructor & Destructor Documentation

◆ TMediaObjectPool() [1/2]

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
TMediaObjectPool< ObjectType, ObjectAllocator >::TMediaObjectPool ( ObjectAllocator ObjectAllocatorInstance = nullptr)
inline

Default constructor.

◆ TMediaObjectPool() [2/2]

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
TMediaObjectPool< ObjectType, ObjectAllocator >::TMediaObjectPool ( uint32  NumReserve)
inline

Create and initialize a new instance.

Parameters
NumReserveNumber of objects to reserve.

Member Function Documentation

◆ Acquire()

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
ObjectType * TMediaObjectPool< ObjectType, ObjectAllocator >::Acquire ( bool  bAlloc = true)
inline

Acquire an untracked object from the pool.

Use the Release method to return the object to the pool. You can use the ToShared and ToUnique methods to convert this object to a tracked shared object later if desired. bAlloc allows to chose if new object should be allocated and added to the pool.

Returns
The object.
See also
AcquireShared, AcquireUnique, Release, ToShared, ToUnique

◆ AcquireShared() [1/2]

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
TSharedRef< ObjectType, ESPMode::ThreadSafe > TMediaObjectPool< ObjectType, ObjectAllocator >::AcquireShared ( )
inline

Acquire a shared object from the pool.

Shared objects do not need to be returned to the pool. They'll be reclaimed automatically when their reference count goes to zero.

Returns
The shared object.
See also
Acquire, AcquireUnique, Reset, ToShared

◆ AcquireShared() [2/2]

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
TSharedPtr< ObjectType, ESPMode::ThreadSafe > TMediaObjectPool< ObjectType, ObjectAllocator >::AcquireShared ( bool  bAlloc)
inline

Acquire a shared object from the pool.

Shared objects do not need to be returned to the pool. They'll be reclaimed automatically when their reference count goes to zero. bAlloc allows to chose if new object should be allocated and added to the pool.

Returns
The shared object.
See also
Acquire, AcquireUnique, Reset, ToShared

◆ Num()

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
int32 TMediaObjectPool< ObjectType, ObjectAllocator >::Num ( ) const
inline

Get the number of objects available in the pool.

Returns
Number of available objects.

◆ Release()

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
void TMediaObjectPool< ObjectType, ObjectAllocator >::Release ( ObjectType *  Object)
inline

Return the given object to the pool.

This method can return plain old C++ objects to the pool. Do not use this method with objects acquired via AcquireShared or AcquireUnique, because those are returned automatically.

See also
Acquire

◆ Reset()

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
void TMediaObjectPool< ObjectType, ObjectAllocator >::Reset ( uint32  NumObjects = 0)
inline

Reset the pool and reserve a specified number of objects.

Parameters
NumObjectsNumber of objects to reserve (default = 0).
See also
GetObject

◆ Tick()

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
void TMediaObjectPool< ObjectType, ObjectAllocator >::Tick ( )
inline

Regular tick call

◆ ToShared()

template<typename ObjectType , typename ObjectAllocator = TMediaPoolDefaultObjectAllocator<ObjectType>>
TSharedRef< ObjectType, ESPMode::ThreadSafe > TMediaObjectPool< ObjectType, ObjectAllocator >::ToShared ( ObjectType *  Object)
inline

Convert an object to a shared pooled object.

Parameters
ObjectThe object to convert.
Returns
The shared object.
See also
AcquireShared, ToUnique

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