cesium-native 0.43.0
|
A reference-counted base class, meant to be used with IntrusivePointer
.
More...
#include <CesiumUtility/ReferenceCounted.h>
Public Member Functions | |
void | addReference () const |
Adds a counted reference to this object. Use CesiumUtility::IntrusivePointer instead of calling this method directly. | |
void | releaseReference () const |
Removes a counted reference from this object. When the last reference is removed, this method will delete this instance. Use CesiumUtility::IntrusivePointer instead of calling this method directly. | |
std::int32_t | getReferenceCount () const noexcept |
Returns the current reference count of this instance. | |
A reference-counted base class, meant to be used with IntrusivePointer
.
Consider using ReferenceCountedThreadSafe
or ReferenceCountedNonThreadSafe
instead of using this class directly.
T | The type that is deriving from this class. For example, you should declare your class as class MyClass : public ReferenceCounted<MyClass> { ... }; |
isThreadSafe | If true , the reference count will be thread-safe by using std::atomic , allowing references to safely be added and removed from any thread at any time. The object will be destroyed in the thread that releases the last reference. If false, it uses a simple integer for the reference count, which is not thread safe. In this case, references must be added and removed (including automatically via IntrusivePointer ) from only one thread at a time. However, this mode has a bit less overhead for objects that are only ever accessed from a single thread. |
Definition at line 50 of file ReferenceCounted.h.
|
inlinenoexcept |
Definition at line 56 of file ReferenceCounted.h.
|
inlinenoexcept |
Definition at line 57 of file ReferenceCounted.h.
|
inline |
Adds a counted reference to this object. Use CesiumUtility::IntrusivePointer
instead of calling this method directly.
Definition at line 64 of file ReferenceCounted.h.
|
inlinenoexcept |
Returns the current reference count of this instance.
Definition at line 97 of file ReferenceCounted.h.
|
inline |
Removes a counted reference from this object. When the last reference is removed, this method will delete this instance. Use CesiumUtility::IntrusivePointer
instead of calling this method directly.
Definition at line 80 of file ReferenceCounted.h.