Blender V5.0
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
12
13#include "MEM_guardedalloc.h"
14
15#include "BLI_sys_types.h"
16
17namespace Freestyle {
18
20 public:
21 inline BaseObject()
22 {
23 _ref_counter = 0;
24 }
25
26 virtual ~BaseObject() {}
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 uint _ref_counter;
53
54 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BaseObject")
55};
56
57} /* namespace Freestyle */
unsigned int uint
Read Guarded memory(de)allocation.
virtual int destroy()
Definition BaseObject.h:31
inherits from class Rep
Definition AppCanvas.cpp:20