RefCountedObject#
Fully qualified name: omni::observability::RefCountedObject
Defined in omni/observability/ObservabilityDebug.h
-
class RefCountedObject#
Base class object used to support simple reference counting in an object.
The reference counting is thread safe.
Subclassed by omni::observability::Logger
Public Functions
-
inline void addRef()#
Adds a reference to this object.
Remark
This adds a single new reference to this object. If the reference count is greater than zero, the object is protected from being destroyed regardless of what order references are released. Each call to this must be balanced with a call to release() when this object is no longer needed.
-
inline void release()#
Releases a reference to this object and potentially destroys it.
Remark
This releases a single reference to this object. If the reference count reaches zero, the object wlil be destroyed immediately. This should only be called to balance a previous call to addRef(). It is the caller’s responsibility to ensure that all references to this object are successfully released. Failure to release all references will result in this object being leaked.
Protected Functions
-
virtual ~RefCountedObject() = default#
Protected destructor.
Remark
This prevents external callers from incorrectly destroying this object directly by generating a compile error if something attempts to pass this object to the
deleteoperator directly. To destroy this object, all references must be released instead.
-
inline void addRef()#