Diligent Engine API Reference
ReferenceCounters.h
1 /* Copyright 2015-2018 Egor Yusov
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12  *
13  * In no event and under no legal theory, whether in tort (including negligence),
14  * contract, or otherwise, unless required by applicable law (such as deliberate
15  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
16  * liable for any damages, including any direct, indirect, special, incidental,
17  * or consequential damages of any character arising as a result of this License or
18  * out of the use or inability to use the software (including but not limited to damages
19  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20  * all other commercial damages or losses), even if such Contributor has been advised
21  * of the possibility of such damages.
22  */
23 
24 #pragma once
25 
28 
29 #include "InterfaceID.h"
30 
31 namespace Diligent
32 {
33 
38 {
39 public:
40  using CounterValueType = long;
41 
43 
48  virtual CounterValueType AddStrongRef() = 0;
49 
50 
54 
64  virtual CounterValueType ReleaseStrongRef() = 0;
65 
66 
68 
73  virtual CounterValueType AddWeakRef() = 0;
74 
75 
78 
83  virtual CounterValueType ReleaseWeakRef() = 0;
84 
85 
87 
95  virtual void GetObject(class IObject **ppObject) = 0;
96 
97 
99 
105  virtual CounterValueType GetNumStrongRefs()const = 0;
106 
107 
109 
113  virtual CounterValueType GetNumWeakRefs()const = 0;
114 };
115 
116 }
Graphics engine namespace.
Definition: AdaptiveFixedBlockAllocator.h:30
virtual CounterValueType AddWeakRef()=0
Increments the number of weak references by 1.
virtual CounterValueType GetNumStrongRefs() const =0
Returns the number of outstanding strong references.
virtual CounterValueType ReleaseWeakRef()=0
Decrements the number of weak references by 1. If there are no more strong and weak references...
virtual void GetObject(class IObject **ppObject)=0
Gets the pointer to the IUnknown interface of the referenced object.
Base interface for a reference counter object that stores the number of strong and weak references an...
Definition: ReferenceCounters.h:37
Base interface for all dynamic objects in the engine.
Definition: Object.h:36
virtual CounterValueType AddStrongRef()=0
Increments the number of strong references by 1.
virtual CounterValueType ReleaseStrongRef()=0
Decrements the number of strong references by 1 and destroys the referenced object when the counter r...
virtual CounterValueType GetNumWeakRefs() const =0
Returns the number of outstanding weak references.