Blender  V3.3
BaseObject.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
11 #ifdef WITH_CXX_GUARDEDALLOC
12 # include "MEM_guardedalloc.h"
13 #endif
14 
15 namespace Freestyle {
16 
17 class BaseObject {
18  public:
19  inline BaseObject()
20  {
21  _ref_counter = 0;
22  }
23 
24  virtual ~BaseObject()
25  {
26  }
27 
31  virtual int destroy()
32  {
33  return release();
34  }
35 
37  inline int addRef()
38  {
39  return ++_ref_counter;
40  }
41 
43  inline int release()
44  {
45  if (_ref_counter) {
46  _ref_counter--;
47  }
48  return _ref_counter;
49  }
50 
51  private:
52  unsigned _ref_counter;
53 
54 #ifdef WITH_CXX_GUARDEDALLOC
55  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BaseObject")
56 #endif
57 };
58 
59 } /* namespace Freestyle */
Read Guarded memory(de)allocation.
virtual int destroy()
Definition: BaseObject.h:31
virtual ~BaseObject()
Definition: BaseObject.h:24
inherits from class Rep
Definition: AppCanvas.cpp:18