13 #ifndef ML_REF_COUNTED_BASE_H
14 #define ML_REF_COUNTED_BASE_H
20 #include <ThirdPartyWarningsDisable.h>
21 #include <boost/intrusive_ptr.hpp>
22 #include <ThirdPartyWarningsRestore.h>
77 ML_UTILS_END_NAMESPACE
80 #define ML_REFCOUNTED_PTR(CLASSNAME) \
82 typedef ::boost::intrusive_ptr<CLASSNAME> CLASSNAME##Ptr; \
83 typedef ::boost::intrusive_ptr<const CLASSNAME> CLASSNAME##ConstPtr;
Class representing general ML objects that support import/export via strings (setPersistentState() an...
EventSourceBase class adds event listener handling to Base.
RefCountedBase class adds intrusive reference counting support to the Base class.
virtual void incRefCount() const
Increases the reference count.
~RefCountedBase() override
Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass....
static void updateReferenceCountingIfSupported(Base *oldValue, Base *newValue, bool &isRefCountedBase)
Helper method that handles incrementing/decrementing of the reference count if base instances support...
virtual void decRefCount() const
Decreases the reference count (object will be deleted if the reference count is decremented to 0).
RefCountedBase(const RefCountedBase &)
Explicit copy constructor.
bool isRefCountedBase() const override
Returns whether the instance is derived from RefCountedBase.
RefCountedBase()
Constructor.
std::atomic_int_least32_t _refCount
Reference count.
#define ML_ABSTRACT_CLASS_HEADER(className)
Similar to ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non-existing export symbol.
void intrusive_ptr_add_ref(const IntrusivePtrBase< Derived > *ptr)
Provide overloads for reference counting functions used by boost::intrusive_ptr.
void intrusive_ptr_release(const IntrusivePtrBase< Derived > *ptr)
#define ML_REFCOUNTED_PTR(CLASSNAME)
Macro that defines convenience Ptr/ConstPtr typedefs to be used instead of intrusive_ptr templates.