forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointerTo.I
More file actions
331 lines (303 loc) · 10.7 KB
/
pointerTo.I
File metadata and controls
331 lines (303 loc) · 10.7 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
// Filename: pointerTo.I
// Created by: drose (10Feb99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE PointerTo<T>::
PointerTo(To *ptr) : PointerToBase<T>(ptr) {
}
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Copy Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE PointerTo<T>::
PointerTo(const PointerTo<T> ©) :
PointerToBase<T>((const PointerToBase<T> &)copy)
{
}
#ifdef USE_MOVE_SEMANTICS
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Move Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE PointerTo<T>::
PointerTo(PointerTo<T> &&from) NOEXCEPT :
PointerToBase<T>(move(from))
{
}
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Move Assignment Operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE PointerTo<T> &PointerTo<T>::
operator = (PointerTo<T> &&from) NOEXCEPT {
this->reassign(move(from));
return *this;
}
#endif // USE_MOVE_SEMANTICS
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Destructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE PointerTo<T>::
~PointerTo() {
}
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Dereference operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE TYPENAME PointerTo<T>::To &PointerTo<T>::
operator *() const {
return *((To *)(this->_void_ptr));
}
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Member access operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE TYPENAME PointerTo<T>::To *PointerTo<T>::
operator -> () const {
return (To *)(this->_void_ptr);
}
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Typecast operator
// Access: Public
// Description: We also have the typecast operator to automatically
// convert PointerTo's to the required kind of actual
// pointer. This introduces ambiguities which the
// compiler will resolve one way or the other, but we
// don't care which way it goes because either will be
// correct.
////////////////////////////////////////////////////////////////////
template<class T>
INLINE PointerTo<T>::
operator T * () const {
return (To *)(this->_void_ptr);
}
////////////////////////////////////////////////////////////////////
// Function: PointerTo::p
// Access: Published
// Description: Returns an ordinary pointer instead of a PointerTo.
// Useful to work around compiler problems, particularly
// for implicit upcasts.
////////////////////////////////////////////////////////////////////
template<class T>
INLINE TYPENAME PointerTo<T>::To *PointerTo<T>::
p() const {
return (To *)(this->_void_ptr);
}
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Assignment operator
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE PointerTo<T> &PointerTo<T>::
operator = (To *ptr) {
this->reassign(ptr);
return *this;
}
////////////////////////////////////////////////////////////////////
// Function: PointerTo::Assignment operator
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE PointerTo<T> &PointerTo<T>::
operator = (const PointerTo<T> ©) {
this->reassign((const PointerToBase<T> &)copy);
return *this;
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T>::
ConstPointerTo(const TYPENAME ConstPointerTo<T>::To *ptr) :
PointerToBase<T>((TYPENAME ConstPointerTo<T>::To *)ptr)
{
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Copy Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T>::
ConstPointerTo(const PointerTo<T> ©) :
PointerToBase<T>((const PointerToBase<T> &)copy)
{
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Destructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T>::
~ConstPointerTo() {
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Copy Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T>::
ConstPointerTo(const ConstPointerTo<T> ©) :
PointerToBase<T>((const PointerToBase<T> &)copy)
{
}
#ifdef USE_MOVE_SEMANTICS
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Move Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T>::
ConstPointerTo(PointerTo<T> &&from) NOEXCEPT :
PointerToBase<T>(move(from))
{
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Move Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T>::
ConstPointerTo(ConstPointerTo<T> &&from) NOEXCEPT :
PointerToBase<T>(move(from))
{
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Move Assignment Operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
operator = (PointerTo<T> &&from) NOEXCEPT {
this->reassign(move(from));
return *this;
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Move Assignment Operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
operator = (ConstPointerTo<T> &&from) NOEXCEPT {
this->reassign(move(from));
return *this;
}
#endif // USE_MOVE_SEMANTICS
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Dereference operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE const TYPENAME ConstPointerTo<T>::To &ConstPointerTo<T>::
operator *() const {
return *((To *)(this->_void_ptr));
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Member access operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE const TYPENAME ConstPointerTo<T>::To *ConstPointerTo<T>::
operator -> () const {
return (To *)(this->_void_ptr);
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Typecast operator
// Access: Public
// Description: We also have the typecast operator to automatically
// convert ConstPointerTo's to the required kind of actual
// pointer. This introduces ambiguities which the
// compiler will resolve one way or the other, but we
// don't care which way it goes because either will be
// correct.
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T>::
operator const T * () const {
return (To *)(this->_void_ptr);
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::p
// Access: Published
// Description: Returns an ordinary pointer instead of a ConstPointerTo.
// Useful to work around compiler problems, particularly
// for implicit upcasts.
////////////////////////////////////////////////////////////////////
template<class T>
INLINE const TYPENAME ConstPointerTo<T>::To *ConstPointerTo<T>::
p() const {
return (To *)(this->_void_ptr);
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Assignment operator
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
operator = (const To *ptr) {
this->reassign((To *)ptr);
return *this;
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Assignment operator
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
operator = (const PointerTo<T> ©) {
this->reassign((const PointerToBase<T> &)copy);
return *this;
}
////////////////////////////////////////////////////////////////////
// Function: ConstPointerTo::Assignment operator
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
template<class T>
INLINE ConstPointerTo<T> &ConstPointerTo<T>::
operator = (const ConstPointerTo<T> ©) {
this->reassign((const PointerToBase<T> &)copy);
return *this;
}