Blender V4.3
MEM_RefCounted.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#ifndef __MEM_REFCOUNTED_H__
12#define __MEM_REFCOUNTED_H__
13
26 public:
31
36 inline virtual int getRef() const;
37
42 inline virtual int incRef();
43
49 inline virtual int decRef();
50
51 protected:
56 virtual ~MEM_RefCounted() {}
57
58 protected:
61};
62
63inline int MEM_RefCounted::getRef() const
64{
65 return m_refCount;
66}
67
69{
70 return ++m_refCount;
71}
72
74{
75 m_refCount--;
76 if (m_refCount == 0) {
77 delete this;
78 return 0;
79 }
80 return m_refCount;
81}
82
83#endif // __MEM_REFCOUNTED_H__
virtual int getRef() const
virtual ~MEM_RefCounted()
virtual int decRef()
virtual int incRef()