MeshLib Documentation
Loading...
Searching...
No Matches
MR::UniqueThreadSafeOwner< T > Class Template Reference

#include <MRUniqueThreadSafeOwner.h>

Public Member Functions

MRMESH_API UniqueThreadSafeOwner ()
 
MRMESH_API UniqueThreadSafeOwner (const UniqueThreadSafeOwner &)
 
MRMESH_API UniqueThreadSafeOwneroperator= (const UniqueThreadSafeOwner &)
 
MRMESH_API UniqueThreadSafeOwner (UniqueThreadSafeOwner &&b) noexcept
 
MRMESH_API UniqueThreadSafeOwneroperator= (UniqueThreadSafeOwner &&b) noexcept
 
MRMESH_API ~UniqueThreadSafeOwner ()
 
MRMESH_API void reset ()
 deletes owned object
 
T * get ()
 returns existing owned object and does not create new one
 
MRMESH_API T & getOrCreate (const std::function< T()> &creator)
 returns existing owned object or creates new one using creator function
 
MRMESH_API void update (const std::function< void(T &)> &updater)
 calls given updater for the owned object (if any)
 
MRMESH_API size_t heapBytes () const
 returns the amount of memory this object occupies on heap
 

Detailed Description

template<typename T>
class MR::UniqueThreadSafeOwner< T >

This class is base class for unique thread safe owning of some objects, for example AABBTree classes derived from this one should have function like getOrCreate

Constructor & Destructor Documentation

◆ UniqueThreadSafeOwner() [1/3]

template<typename T >
MRMESH_API MR::UniqueThreadSafeOwner< T >::UniqueThreadSafeOwner ( )

◆ UniqueThreadSafeOwner() [2/3]

template<typename T >
MRMESH_API MR::UniqueThreadSafeOwner< T >::UniqueThreadSafeOwner ( const UniqueThreadSafeOwner< T > & )

◆ UniqueThreadSafeOwner() [3/3]

template<typename T >
MRMESH_API MR::UniqueThreadSafeOwner< T >::UniqueThreadSafeOwner ( UniqueThreadSafeOwner< T > && b)
noexcept

◆ ~UniqueThreadSafeOwner()

Member Function Documentation

◆ get()

template<typename T >
T * MR::UniqueThreadSafeOwner< T >::get ( )
inline

returns existing owned object and does not create new one

◆ getOrCreate()

template<typename T >
MRMESH_API T & MR::UniqueThreadSafeOwner< T >::getOrCreate ( const std::function< T()> & creator)

returns existing owned object or creates new one using creator function

◆ heapBytes()

template<typename T >
MRMESH_API size_t MR::UniqueThreadSafeOwner< T >::heapBytes ( ) const
nodiscard

returns the amount of memory this object occupies on heap

◆ operator=() [1/2]

template<typename T >
MRMESH_API UniqueThreadSafeOwner & MR::UniqueThreadSafeOwner< T >::operator= ( const UniqueThreadSafeOwner< T > & )

◆ operator=() [2/2]

template<typename T >
MRMESH_API UniqueThreadSafeOwner & MR::UniqueThreadSafeOwner< T >::operator= ( UniqueThreadSafeOwner< T > && b)
noexcept

◆ reset()

template<typename T >
MRMESH_API void MR::UniqueThreadSafeOwner< T >::reset ( )

deletes owned object

◆ update()

template<typename T >
MRMESH_API void MR::UniqueThreadSafeOwner< T >::update ( const std::function< void(T &)> & updater)

calls given updater for the owned object (if any)


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