#include <MRUniqueThreadSafeOwner.h>
Public Member Functions | |
MRMESH_API | UniqueThreadSafeOwner () |
MRMESH_API | UniqueThreadSafeOwner (const UniqueThreadSafeOwner &) |
MRMESH_API UniqueThreadSafeOwner & | operator= (const UniqueThreadSafeOwner &) |
MRMESH_API | UniqueThreadSafeOwner (UniqueThreadSafeOwner &&b) noexcept |
MRMESH_API UniqueThreadSafeOwner & | operator= (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 | |
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
MRMESH_API MR::UniqueThreadSafeOwner< T >::UniqueThreadSafeOwner | ( | ) |
MRMESH_API MR::UniqueThreadSafeOwner< T >::UniqueThreadSafeOwner | ( | const UniqueThreadSafeOwner< T > & | ) |
|
noexcept |
MRMESH_API MR::UniqueThreadSafeOwner< T >::~UniqueThreadSafeOwner | ( | ) |
|
inline |
returns existing owned object and does not create new one
MRMESH_API T & MR::UniqueThreadSafeOwner< T >::getOrCreate | ( | const std::function< T()> & | creator | ) |
returns existing owned object or creates new one using creator function
|
nodiscard |
returns the amount of memory this object occupies on heap
MRMESH_API UniqueThreadSafeOwner & MR::UniqueThreadSafeOwner< T >::operator= | ( | const UniqueThreadSafeOwner< T > & | ) |
|
noexcept |
MRMESH_API void MR::UniqueThreadSafeOwner< T >::reset | ( | ) |
deletes owned object
MRMESH_API void MR::UniqueThreadSafeOwner< T >::update | ( | const std::function< void(T &)> & | updater | ) |
calls given updater for the owned object (if any)