OptiX
3.9
NVIDIA OptiX Acceleration Engine
Main Page
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
optix_prime
internal
Ref.h
1
2
/*
3
* Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
4
*
5
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
6
* rights in and to this software, related documentation and any modifications thereto.
7
* Any use, reproduction, disclosure or distribution of this software and related
8
* documentation without an express license agreement from NVIDIA Corporation is strictly
9
* prohibited.
10
*
11
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
12
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
13
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
15
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
16
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
17
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
18
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
19
* SUCH DAMAGES
20
*/
21
22
#ifndef __optix_optix_prime_ref_h__
23
#define __optix_optix_prime_ref_h__
24
25
#include "Atom.h"
26
27
namespace
optix {
28
namespace
prime {
29
31
33
class
RefCountedObj
34
{
35
public
:
37
RefCountedObj(
unsigned
int
refCnt=1 ) : m_refCnt( refCnt ) { }
38
40
virtual
~RefCountedObj() { }
41
42
private
:
43
friend
class
ContextObj;
44
friend
class
ModelObj;
45
template
<
class
RefCountedObj>
friend
class
Handle;
46
48
virtual
unsigned
int
ref();
49
51
virtual
unsigned
int
unref();
52
53
mutable
Atom32 m_refCnt;
54
};
55
56
57
//
58
// Increment the reference count
59
//
60
inline
unsigned
int
RefCountedObj::ref() {
61
return
++m_refCnt;
62
}
63
64
65
//
66
// Decrement the reference count
67
//
68
inline
unsigned
int
RefCountedObj::unref() {
69
unsigned
int
cnt = --m_refCnt;
70
if
( !cnt) {
71
delete
this
;
72
}
73
74
return
cnt;
75
}
76
78
79
}
// end namespace prime
80
}
// end namespace optix
81
82
#endif // #ifndef __optix_optix_prime_ref_h__
Generated on Thu Mar 31 2016 09:25:40 for OptiX by
1.8.6