Blender  V3.3
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MEM_RefCounted Class Reference

#include <MEM_RefCounted.h>

Public Member Functions

 MEM_RefCounted ()
 
virtual int getRef () const
 
virtual int incRef ()
 
virtual int decRef ()
 

Protected Member Functions

virtual ~MEM_RefCounted ()
 

Protected Attributes

int m_refCount
 

Detailed Description

An object with reference counting. Base class for objects with reference counting. When a shared object is ceated, it has reference count == 1. If the reference count of a shared object reaches zero, the object self-destructs. The default destructor of this object has been made protected on purpose. This disables the creation of shared objects on the stack.

Author
Maarten Gribnau
Date
March 31, 2001

Definition at line 25 of file MEM_RefCounted.h.

Constructor & Destructor Documentation

◆ MEM_RefCounted()

MEM_RefCounted::MEM_RefCounted ( )
inline

Constructs a shared object.

Definition at line 30 of file MEM_RefCounted.h.

◆ ~MEM_RefCounted()

virtual MEM_RefCounted::~MEM_RefCounted ( )
inlineprotectedvirtual

Destructs a shared object. The destructor is protected to force the use of incRef and decRef.

Definition at line 58 of file MEM_RefCounted.h.

Member Function Documentation

◆ decRef()

int MEM_RefCounted::decRef ( )
inlinevirtual

Decreases the reference count of this object. If the reference count reaches zero, the object self-destructs.

Returns
the new reference count.

Definition at line 77 of file MEM_RefCounted.h.

References m_refCount.

◆ getRef()

int MEM_RefCounted::getRef ( ) const
inlinevirtual

Returns the reference count of this object.

Returns
the reference count.

Definition at line 67 of file MEM_RefCounted.h.

References m_refCount.

◆ incRef()

int MEM_RefCounted::incRef ( )
inlinevirtual

Increases the reference count of this object.

Returns
the new reference count.

Definition at line 72 of file MEM_RefCounted.h.

References m_refCount.

Member Data Documentation

◆ m_refCount

int MEM_RefCounted::m_refCount
protected

The reference count.

Definition at line 64 of file MEM_RefCounted.h.

Referenced by decRef(), getRef(), and incRef().


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