1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
<html>
<head>
<title>NVIDIA(R) Blast(R) SDK 1.1 Source Reference: sdk/extensions/authoring/source/VHACD/inc/btAlignedAllocator.h Source File</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK HREF="NVIDIA.css" REL="stylesheet" TYPE="text/css">
</head>
<body bgcolor="#FFFFFF">
<div id="header">
<hr class="first">
<img alt="" src="blast_logo.png">
<br>
<center>
<a class="qindex" href="main.html">Main Page</a>
<!-- <a class="qindex" href="hierarchy.html">Class Hierarchy</a> //-->
<a class="qindex" href="annotated.html">Class List</a>
<a class="qindex" href="functions.html">Class Members</a>
</center>
<hr class="second">
</div>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>User's Guide</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<h1>sdk/extensions/authoring/source/VHACD/inc/btAlignedAllocator.h</h1><a href="bt_aligned_allocator_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">Bullet Continuous Collision Detection and Physics Library</span>
<a name="l00003"></a>00003 <span class="comment">Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">This software is provided 'as-is', without any express or implied warranty.</span>
<a name="l00006"></a>00006 <span class="comment">In no event will the authors be held liable for any damages arising from the use of this software.</span>
<a name="l00007"></a>00007 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00008"></a>00008 <span class="comment">including commercial applications, and to alter it and redistribute it freely,</span>
<a name="l00009"></a>00009 <span class="comment">subject to the following restrictions:</span>
<a name="l00010"></a>00010 <span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment">1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.</span>
<a name="l00012"></a>00012 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.</span>
<a name="l00013"></a>00013 <span class="comment">3. This notice may not be removed or altered from any source distribution.</span>
<a name="l00014"></a>00014 <span class="comment">*/</span>
<a name="l00015"></a>00015
<a name="l00016"></a>00016 <span class="preprocessor">#ifndef BT_ALIGNED_ALLOCATOR</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#define BT_ALIGNED_ALLOCATOR</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span>
<a name="l00022"></a>00022
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="bt_scalar_8h.html">btScalar.h</a>"</span>
<a name="l00024"></a>00024 <span class="comment">//#define BT_DEBUG_MEMORY_ALLOCATIONS 1</span>
<a name="l00025"></a>00025 <span class="preprocessor">#ifdef BT_DEBUG_MEMORY_ALLOCATIONS</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="preprocessor">#define btAlignedAlloc(a, b) \</span>
<a name="l00028"></a>00028 <span class="preprocessor"> btAlignedAllocInternal(a, b, __LINE__, __FILE__)</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span>
<a name="l00030"></a>00030 <span class="preprocessor">#define btAlignedFree(ptr) \</span>
<a name="l00031"></a>00031 <span class="preprocessor"> btAlignedFreeInternal(ptr, __LINE__, __FILE__)</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="keywordtype">void</span>* <a class="code" href="bt_aligned_allocator_8h.html#bd143f95ed595805aaeda47d8ecf9a1d">btAlignedAllocInternal</a>(<span class="keywordtype">size_t</span> size, int32_t alignment, int32_t line, <span class="keywordtype">char</span>* filename);
<a name="l00034"></a>00034
<a name="l00035"></a>00035 <span class="keywordtype">void</span> <a class="code" href="bt_aligned_allocator_8h.html#e81156ba7103afa1011e445b990041a6">btAlignedFreeInternal</a>(<span class="keywordtype">void</span>* ptr, int32_t line, <span class="keywordtype">char</span>* filename);
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#else</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="keywordtype">void</span>* <a class="code" href="bt_aligned_allocator_8h.html#bd143f95ed595805aaeda47d8ecf9a1d">btAlignedAllocInternal</a>(<span class="keywordtype">size_t</span> size, int32_t alignment);
<a name="l00039"></a>00039 <span class="keywordtype">void</span> <a class="code" href="bt_aligned_allocator_8h.html#e81156ba7103afa1011e445b990041a6">btAlignedFreeInternal</a>(<span class="keywordtype">void</span>* ptr);
<a name="l00040"></a>00040
<a name="l00041"></a><a class="code" href="bt_aligned_allocator_8h.html#5798ef3418d84a1761ef917ef6720db7">00041</a> <span class="preprocessor">#define btAlignedAlloc(size, alignment) btAlignedAllocInternal(size, alignment)</span>
<a name="l00042"></a><a class="code" href="bt_aligned_allocator_8h.html#053f25687d0cd7a29571c8669cf9bcd4">00042</a> <span class="preprocessor"></span><span class="preprocessor">#define btAlignedFree(ptr) btAlignedFreeInternal(ptr)</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span>
<a name="l00044"></a>00044 <span class="preprocessor">#endif</span>
<a name="l00045"></a><a class="code" href="bt_aligned_allocator_8h.html#b99502f04b45da821f566776d800a8f9">00045</a> <span class="preprocessor"></span><span class="keyword">typedef</span> int32_t <a class="code" href="bt_aligned_allocator_8h.html#b99502f04b45da821f566776d800a8f9">size_type</a>;
<a name="l00046"></a>00046
<a name="l00047"></a><a class="code" href="bt_aligned_allocator_8h.html#53aebe85a383ecbc3799fa7178579fd6">00047</a> <span class="keyword">typedef</span> <span class="keywordtype">void</span>*(<a class="code" href="bt_aligned_allocator_8h.html#53aebe85a383ecbc3799fa7178579fd6">btAlignedAllocFunc</a>)(<span class="keywordtype">size_t</span> size, int32_t alignment);
<a name="l00048"></a><a class="code" href="bt_aligned_allocator_8h.html#3c990039e5a83916adef8f7b67a535d5">00048</a> <span class="keyword">typedef</span> void(<a class="code" href="bt_aligned_allocator_8h.html#3c990039e5a83916adef8f7b67a535d5">btAlignedFreeFunc</a>)(<span class="keywordtype">void</span>* memblock);
<a name="l00049"></a><a class="code" href="bt_aligned_allocator_8h.html#4d0f231478598c2f1ea78738bfee630a">00049</a> <span class="keyword">typedef</span> <span class="keywordtype">void</span>*(<a class="code" href="bt_aligned_allocator_8h.html#4d0f231478598c2f1ea78738bfee630a">btAllocFunc</a>)(<span class="keywordtype">size_t</span> size);
<a name="l00050"></a><a class="code" href="bt_aligned_allocator_8h.html#f861518a1c1fd9eb001104bdcc0c6a55">00050</a> <span class="keyword">typedef</span> void(<a class="code" href="bt_aligned_allocator_8h.html#f861518a1c1fd9eb001104bdcc0c6a55">btFreeFunc</a>)(<span class="keywordtype">void</span>* memblock);
<a name="l00051"></a>00051
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="bt_aligned_allocator_8h.html#f50f59e1b711a0304f02b64ef1b72b8f" title="The developer can let all Bullet memory allocations go through a custom memory allocator...">btAlignedAllocSetCustom</a>(<a class="code" href="bt_aligned_allocator_8h.html#4d0f231478598c2f1ea78738bfee630a">btAllocFunc</a>* allocFunc, <a class="code" href="bt_aligned_allocator_8h.html#f861518a1c1fd9eb001104bdcc0c6a55">btFreeFunc</a>* freeFunc);
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="bt_aligned_allocator_8h.html#7d5a4fe5c3391787ca69c33268486ff5" title="If the developer has already an custom aligned allocator, then btAlignedAllocSetCustomAligned...">btAlignedAllocSetCustomAligned</a>(<a class="code" href="bt_aligned_allocator_8h.html#53aebe85a383ecbc3799fa7178579fd6">btAlignedAllocFunc</a>* allocFunc, <a class="code" href="bt_aligned_allocator_8h.html#3c990039e5a83916adef8f7b67a535d5">btAlignedFreeFunc</a>* freeFunc);
<a name="l00056"></a>00056
<a name="l00059"></a>00059 <span class="keyword">template</span> <<span class="keyword">typename</span> T, <span class="keywordtype">unsigned</span> Alignment>
<a name="l00060"></a><a class="code" href="classbt_aligned_allocator.html">00060</a> <span class="keyword">class </span><a class="code" href="classbt_aligned_allocator.html">btAlignedAllocator</a> {
<a name="l00061"></a>00061
<a name="l00062"></a>00062 <span class="keyword">typedef</span> <a class="code" href="classbt_aligned_allocator.html">btAlignedAllocator<T, Alignment></a> <a class="code" href="classbt_aligned_allocator.html">self_type</a>;
<a name="l00063"></a>00063
<a name="l00064"></a>00064 <span class="keyword">public</span>:
<a name="l00065"></a>00065 <span class="comment">//just going down a list:</span>
<a name="l00066"></a><a class="code" href="classbt_aligned_allocator.html#000ba6fd8c6b3ffe7609dcef5d606cf6">00066</a> <a class="code" href="classbt_aligned_allocator.html#000ba6fd8c6b3ffe7609dcef5d606cf6">btAlignedAllocator</a>() {}
<a name="l00067"></a>00067 <span class="comment">/*</span>
<a name="l00068"></a>00068 <span class="comment"> btAlignedAllocator( const self_type & ) {}</span>
<a name="l00069"></a>00069 <span class="comment"> */</span>
<a name="l00070"></a>00070
<a name="l00071"></a>00071 <span class="keyword">template</span> <<span class="keyword">typename</span> Other>
<a name="l00072"></a><a class="code" href="classbt_aligned_allocator.html#19551eb4d8e61db5fb7e44376d643513">00072</a> <a class="code" href="classbt_aligned_allocator.html#19551eb4d8e61db5fb7e44376d643513">btAlignedAllocator</a>(<span class="keyword">const</span> <a class="code" href="classbt_aligned_allocator.html">btAlignedAllocator<Other, Alignment></a>&) {}
<a name="l00073"></a>00073
<a name="l00074"></a><a class="code" href="classbt_aligned_allocator.html#0e891e100940277ebbd7272040f10e03">00074</a> <span class="keyword">typedef</span> <span class="keyword">const</span> T* <a class="code" href="classbt_aligned_allocator.html#0e891e100940277ebbd7272040f10e03">const_pointer</a>;
<a name="l00075"></a><a class="code" href="classbt_aligned_allocator.html#e5f6da84ca9c043329e3aae5c7fb3899">00075</a> <span class="keyword">typedef</span> <span class="keyword">const</span> T& <a class="code" href="classbt_aligned_allocator.html#e5f6da84ca9c043329e3aae5c7fb3899">const_reference</a>;
<a name="l00076"></a><a class="code" href="classbt_aligned_allocator.html#437328614e195e0241532556ebb24585">00076</a> <span class="keyword">typedef</span> T* <a class="code" href="classbt_aligned_allocator.html#437328614e195e0241532556ebb24585">pointer</a>;
<a name="l00077"></a><a class="code" href="classbt_aligned_allocator.html#e700086710c0e3968d6291a58afb5179">00077</a> <span class="keyword">typedef</span> T& <a class="code" href="classbt_aligned_allocator.html#e700086710c0e3968d6291a58afb5179">reference</a>;
<a name="l00078"></a><a class="code" href="classbt_aligned_allocator.html#dbcb544104a69cedd789d279c03ff861">00078</a> <span class="keyword">typedef</span> T <a class="code" href="classbt_aligned_allocator.html#dbcb544104a69cedd789d279c03ff861">value_type</a>;
<a name="l00079"></a>00079
<a name="l00080"></a><a class="code" href="classbt_aligned_allocator.html#dcead335266c1a9b6ab7a881cdfb2123">00080</a> <a class="code" href="classbt_aligned_allocator.html#437328614e195e0241532556ebb24585">pointer</a> <a class="code" href="classbt_aligned_allocator.html#dcead335266c1a9b6ab7a881cdfb2123">address</a>(<a class="code" href="classbt_aligned_allocator.html#e700086710c0e3968d6291a58afb5179">reference</a> ref)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> &ref; }
<a name="l00081"></a><a class="code" href="classbt_aligned_allocator.html#a43b8d203b56c23838c7468496564f5d">00081</a> <a class="code" href="classbt_aligned_allocator.html#0e891e100940277ebbd7272040f10e03">const_pointer</a> <a class="code" href="classbt_aligned_allocator.html#a43b8d203b56c23838c7468496564f5d">address</a>(<a class="code" href="classbt_aligned_allocator.html#e5f6da84ca9c043329e3aae5c7fb3899">const_reference</a> ref)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> &ref; }
<a name="l00082"></a><a class="code" href="classbt_aligned_allocator.html#5b14474126ff00cd364dfb74304ec6c3">00082</a> <a class="code" href="classbt_aligned_allocator.html#437328614e195e0241532556ebb24585">pointer</a> <a class="code" href="classbt_aligned_allocator.html#5b14474126ff00cd364dfb74304ec6c3">allocate</a>(<a class="code" href="bt_aligned_allocator_8h.html#b99502f04b45da821f566776d800a8f9">size_type</a> n, <a class="code" href="classbt_aligned_allocator.html#0e891e100940277ebbd7272040f10e03">const_pointer</a>* hint = 0)
<a name="l00083"></a>00083 {
<a name="l00084"></a>00084 (void)hint;
<a name="l00085"></a>00085 <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast<</span><a class="code" href="classbt_aligned_allocator.html#437328614e195e0241532556ebb24585">pointer</a><span class="keyword">></span>(<a class="code" href="bt_aligned_allocator_8h.html#5798ef3418d84a1761ef917ef6720db7">btAlignedAlloc</a>(<span class="keyword">sizeof</span>(<a class="code" href="classbt_aligned_allocator.html#dbcb544104a69cedd789d279c03ff861">value_type</a>) * n, Alignment));
<a name="l00086"></a>00086 }
<a name="l00087"></a><a class="code" href="classbt_aligned_allocator.html#fdb40058534d13fed3fddade2939bd8e">00087</a> <span class="keywordtype">void</span> <a class="code" href="classbt_aligned_allocator.html#fdb40058534d13fed3fddade2939bd8e">construct</a>(<a class="code" href="classbt_aligned_allocator.html#437328614e195e0241532556ebb24585">pointer</a> ptr, <span class="keyword">const</span> <a class="code" href="classbt_aligned_allocator.html#dbcb544104a69cedd789d279c03ff861">value_type</a>& value) { <span class="keyword">new</span> (ptr) <a class="code" href="classbt_aligned_allocator.html#dbcb544104a69cedd789d279c03ff861">value_type</a>(value); }
<a name="l00088"></a><a class="code" href="classbt_aligned_allocator.html#9aa2ce10c6b68eb249116f8712008724">00088</a> <span class="keywordtype">void</span> <a class="code" href="classbt_aligned_allocator.html#9aa2ce10c6b68eb249116f8712008724">deallocate</a>(<a class="code" href="classbt_aligned_allocator.html#437328614e195e0241532556ebb24585">pointer</a> ptr)
<a name="l00089"></a>00089 {
<a name="l00090"></a>00090 <a class="code" href="bt_aligned_allocator_8h.html#053f25687d0cd7a29571c8669cf9bcd4">btAlignedFree</a>(reinterpret_cast<void*>(ptr));
<a name="l00091"></a>00091 }
<a name="l00092"></a><a class="code" href="classbt_aligned_allocator.html#8570a358258bc64869f0effd8405b69b">00092</a> <span class="keywordtype">void</span> <a class="code" href="classbt_aligned_allocator.html#8570a358258bc64869f0effd8405b69b">destroy</a>(<a class="code" href="classbt_aligned_allocator.html#437328614e195e0241532556ebb24585">pointer</a> ptr) { ptr->~value_type(); }
<a name="l00093"></a>00093
<a name="l00094"></a>00094 <span class="keyword">template</span> <<span class="keyword">typename</span> O>
<a name="l00095"></a><a class="code" href="structbt_aligned_allocator_1_1rebind.html">00095</a> <span class="keyword">struct </span><a class="code" href="structbt_aligned_allocator_1_1rebind.html">rebind</a> {
<a name="l00096"></a><a class="code" href="structbt_aligned_allocator_1_1rebind.html#0d5a44097d263bb5af68ff9030c60d61">00096</a> <span class="keyword">typedef</span> <a class="code" href="classbt_aligned_allocator.html">btAlignedAllocator<O, Alignment></a> <a class="code" href="classbt_aligned_allocator.html">other</a>;
<a name="l00097"></a>00097 };
<a name="l00098"></a>00098 <span class="keyword">template</span> <<span class="keyword">typename</span> O>
<a name="l00099"></a><a class="code" href="classbt_aligned_allocator.html#a0d4754d1166776be89f4f40e06728d9">00099</a> <a class="code" href="classbt_aligned_allocator.html">self_type</a>& <a class="code" href="classbt_aligned_allocator.html#a0d4754d1166776be89f4f40e06728d9">operator=</a>(<span class="keyword">const</span> <a class="code" href="classbt_aligned_allocator.html">btAlignedAllocator<O, Alignment></a>&) { <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00100"></a>00100
<a name="l00101"></a><a class="code" href="classbt_aligned_allocator.html#925f6a7a595252ceb9a7c4be506f983c">00101</a> <span class="keyword">friend</span> <span class="keywordtype">bool</span> <a class="code" href="classbt_aligned_allocator.html#925f6a7a595252ceb9a7c4be506f983c">operator==</a>(<span class="keyword">const</span> <a class="code" href="classbt_aligned_allocator.html">self_type</a>&, <span class="keyword">const</span> <a class="code" href="classbt_aligned_allocator.html">self_type</a>&) { <span class="keywordflow">return</span> <span class="keyword">true</span>; }
<a name="l00102"></a>00102 };
<a name="l00103"></a>00103
<a name="l00104"></a>00104 <span class="preprocessor">#endif //BT_ALIGNED_ALLOCATOR</span>
</pre></div></div>
<!-- start footer part -->
<div class="footer">
Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. <a href="http://www.nvidia.com ">www.nvidia.com</a>
</div>
</body>
</html>
|