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