Blender  V3.3
MEM_RefCounted.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
10 #ifndef __MEM_REFCOUNTED_H__
11 #define __MEM_REFCOUNTED_H__
12 
26  public:
31  {
32  }
33 
38  inline virtual int getRef() const;
39 
44  inline virtual int incRef();
45 
51  inline virtual int decRef();
52 
53  protected:
58  virtual ~MEM_RefCounted()
59  {
60  }
61 
62  protected:
65 };
66 
67 inline int MEM_RefCounted::getRef() const
68 {
69  return m_refCount;
70 }
71 
73 {
74  return ++m_refCount;
75 }
76 
78 {
79  m_refCount--;
80  if (m_refCount == 0) {
81  delete this;
82  return 0;
83  }
84  return m_refCount;
85 }
86 
87 #endif // __MEM_REFCOUNTED_H__
virtual int getRef() const
virtual ~MEM_RefCounted()
virtual int decRef()
virtual int incRef()