TDME2 1.9.121
Reference.h
Go to the documentation of this file.
1#pragma once
2
3#include <tdme/tdme.h>
5
6/**
7 * Reference counter implementation to be used with inheritance
8 * @author Andreas Drewke
9 */
11public:
12 /**
13 * @brief Public constructor
14 */
15 Reference();
16
17 /**
18 * @brief destructor
19 */
20 virtual ~Reference();
21
22 /**
23 * @brief acquires a reference, incrementing the counter
24 */
25 void acquireReference();
26
27 /**
28 * @brief releases a reference, thus decrementing the counter and delete it if reference counter is zero
29 */
30 void releaseReference();
31
32 /**
33 * Callback method to be overridden, will be called if object will be deleted
34 */
35 virtual void onDelete();
36
37private:
38 unsigned int referenceCounter;
39};
Reference counter implementation to be used with inheritance.
Definition: Reference.h:10
Reference()
Public constructor.
Definition: Reference.cpp:10
virtual ~Reference()
destructor
Definition: Reference.cpp:13
void releaseReference()
releases a reference, thus decrementing the counter and delete it if reference counter is zero
Definition: Reference.cpp:20
unsigned int referenceCounter
Definition: Reference.h:38
virtual void onDelete()
Callback method to be overridden, will be called if object will be deleted.
Definition: Reference.cpp:27
void acquireReference()
acquires a reference, incrementing the counter
Definition: Reference.cpp:16