MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
mxl::lib::Instance::RefCounted< T > Class Template Reference

Public Types

using value_type = T

Public Member Functions

constexpr void addReference () const noexcept
constexpr value_type const * get () const noexcept
constexpr value_type * get () noexcept
RefCounted & operator= (RefCounted &&)=delete
RefCounted & operator= (RefCounted const &)=delete
 RefCounted (RefCounted &&)=delete
 RefCounted (RefCounted const &)=delete
 RefCounted (std::unique_ptr< value_type > &&value) noexcept
constexpr std::uint64_t referenceCount () const noexcept
constexpr bool releaseReference () const noexcept

Private Attributes

std::unique_ptr< value_type > _ptr
std::uint64_t _refCount

Detailed Description

template<typename T>
class mxl::lib::Instance::RefCounted< T >

Definition at line 126 of file Instance.hpp.

Member Typedef Documentation

◆ value_type

template<typename T>
using mxl::lib::Instance::RefCounted< T >::value_type = T

Definition at line 129 of file Instance.hpp.

Constructor & Destructor Documentation

◆ RefCounted() [1/3]

template<typename T>
mxl::lib::Instance::RefCounted< T >::RefCounted ( std::unique_ptr< value_type > && value)
inlineexplicitnoexcept

Definition at line 211 of file Instance.hpp.

213 , _refCount{1U}
214 {}
std::unique_ptr< value_type > _ptr
Definition Instance.hpp:148

◆ RefCounted() [2/3]

template<typename T>
mxl::lib::Instance::RefCounted< T >::RefCounted ( RefCounted< T > && )
delete

◆ RefCounted() [3/3]

template<typename T>
mxl::lib::Instance::RefCounted< T >::RefCounted ( RefCounted< T > const & )
delete

Member Function Documentation

◆ addReference()

template<typename T>
void mxl::lib::Instance::RefCounted< T >::addReference ( ) const
constexprnoexcept

Definition at line 229 of file Instance.hpp.

230 {
231 _refCount += 1U;
232 }

◆ get() [1/2]

template<typename T>
value_type const * mxl::lib::Instance::RefCounted< T >::get ( ) const
constexprnoexcept

◆ get() [2/2]

template<typename T>
value_type * mxl::lib::Instance::RefCounted< T >::get ( )
constexprnoexcept

◆ operator=() [1/2]

template<typename T>
RefCounted & mxl::lib::Instance::RefCounted< T >::operator= ( RefCounted< T > && )
delete

◆ operator=() [2/2]

template<typename T>
RefCounted & mxl::lib::Instance::RefCounted< T >::operator= ( RefCounted< T > const & )
delete

◆ referenceCount()

template<typename T>
std::uint64_t mxl::lib::Instance::RefCounted< T >::referenceCount ( ) const
constexprnoexcept

Definition at line 242 of file Instance.hpp.

243 {
244 return _refCount;
245 }

◆ releaseReference()

template<typename T>
bool mxl::lib::Instance::RefCounted< T >::releaseReference ( ) const
constexprnoexcept

Definition at line 235 of file Instance.hpp.

236 {
237 _refCount -= (_refCount > 0U) ? 1U : 0U;
238 return (_refCount == 0U);
239 }

Member Data Documentation

◆ _ptr

template<typename T>
std::unique_ptr<value_type> mxl::lib::Instance::RefCounted< T >::_ptr
private

Definition at line 148 of file Instance.hpp.

◆ _refCount

template<typename T>
std::uint64_t mxl::lib::Instance::RefCounted< T >::_refCount
mutableprivate

Definition at line 149 of file Instance.hpp.


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