Panda3D

Loading...
Searching...
No Matches
nodePointerTo.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file nodePointerTo.I
10 * @author drose
11 * @date 2005-05-07
12 */
13
14#ifndef CPPPARSER
15/**
16 *
17 */
18 template<class T>
19INLINE NodePointerTo<T>::
20 NodePointerTo(To *ptr) : NodePointerToBase<T>(ptr) {
21}
22#endif // CPPPARSER
23
24#ifndef CPPPARSER
25/**
26 *
27 */
28 template<class T>
29INLINE NodePointerTo<T>::
30 NodePointerTo(const NodePointerTo<T> &copy) :
31 NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
32{
33}
34#endif // CPPPARSER
35
36#ifndef CPPPARSER
37/**
38 *
39 */
40 template<class T>
41INLINE NodePointerTo<T>::
42 NodePointerTo(NodePointerTo<T> &&from) noexcept :
43 NodePointerToBase<T>((NodePointerToBase<T> &&)from)
44{
45}
46#endif // CPPPARSER
47
48#ifndef CPPPARSER
49/**
50 *
51 */
52 template<class T>
53INLINE NodePointerTo<T> &NodePointerTo<T>::
54 operator = (NodePointerTo<T> &&from) noexcept {
55 this->reassign(std::move(from));
56 return *this;
57}
58#endif // CPPPARSER
59
60#ifndef CPPPARSER
61/**
62 *
63 */
64 template<class T>
65INLINE typename NodePointerTo<T>::To &NodePointerTo<T>::
66 operator *() const {
67 return *((To *)(this->_void_ptr));
68}
69#endif // CPPPARSER
70
71#ifndef CPPPARSER
72/**
73 *
74 */
75 template<class T>
76INLINE typename NodePointerTo<T>::To *NodePointerTo<T>::
77 operator -> () const {
78 return (To *)(this->_void_ptr);
79}
80#endif // CPPPARSER
81
82#ifndef CPPPARSER
83/**
84 * We also have the typecast operator to automatically convert NodePointerTo's
85 * to the required kind of actual pointer. This introduces ambiguities which
86 * the compiler will resolve one way or the other, but we don't care which way
87 * it goes because either will be correct.
88 */
89 template<class T>
90INLINE NodePointerTo<T>::
91operator T *() const {
92 return (To *)(this->_void_ptr);
93}
94#endif // CPPPARSER
95
96#ifndef CPPPARSER
97/**
98 * Returns an ordinary pointer instead of a NodePointerTo. Useful to work
99 * around compiler problems, particularly for implicit upcasts.
100 */
101 template<class T>
102INLINE typename NodePointerTo<T>::To *NodePointerTo<T>::
103 p() const {
104 return (To *)(this->_void_ptr);
105}
106#endif // CPPPARSER
107
108#ifndef CPPPARSER
109/**
110 *
111 */
112 template<class T>
113INLINE NodePointerTo<T> &NodePointerTo<T>::
114 operator = (To *ptr) {
115 this->reassign(ptr);
116 return *this;
117}
118#endif // CPPPARSER
119
120#ifndef CPPPARSER
121/**
122 *
123 */
124 template<class T>
125INLINE NodePointerTo<T> &NodePointerTo<T>::
126 operator = (const NodePointerTo<T> &copy) {
127 this->reassign((const NodePointerToBase<T> &)copy);
128 return *this;
129}
130#endif // CPPPARSER
131
132#ifndef CPPPARSER
133/**
134 *
135 */
136 template<class T>
137INLINE NodeConstPointerTo<T>::
138 NodeConstPointerTo(const typename NodeConstPointerTo<T>::To *ptr) :
139 NodePointerToBase<T>((typename NodeConstPointerTo<T>::To *)ptr)
140{
141}
142#endif // CPPPARSER
143
144#ifndef CPPPARSER
145/**
146 *
147 */
148 template<class T>
149INLINE NodeConstPointerTo<T>::
150 NodeConstPointerTo(const NodePointerTo<T> &copy) :
151 NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
152{
153}
154#endif // CPPPARSER
155
156#ifndef CPPPARSER
157/**
158 *
159 */
160 template<class T>
161INLINE NodeConstPointerTo<T>::
162 NodeConstPointerTo(const NodeConstPointerTo<T> &copy) :
163 NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
164{
165}
166#endif // CPPPARSER
167
168#ifndef CPPPARSER
169/**
170 *
171 */
172 template<class T>
173INLINE NodeConstPointerTo<T>::
174 NodeConstPointerTo(NodePointerTo<T> &&from) noexcept :
175 NodePointerToBase<T>((NodePointerToBase<T> &&)from)
176{
177}
178#endif // CPPPARSER
179
180#ifndef CPPPARSER
181/**
182 *
183 */
184 template<class T>
185INLINE NodeConstPointerTo<T>::
186 NodeConstPointerTo(NodeConstPointerTo<T> &&from) noexcept :
187 NodePointerToBase<T>((NodePointerToBase<T> &&)from)
188{
189}
190#endif // CPPPARSER
191
192#ifndef CPPPARSER
193/**
194 *
195 */
196 template<class T>
197INLINE NodeConstPointerTo<T> &NodeConstPointerTo<T>::
198 operator = (NodePointerTo<T> &&from) noexcept {
199 this->reassign(std::move(from));
200 return *this;
201}
202#endif // CPPPARSER
203
204#ifndef CPPPARSER
205/**
206 *
207 */
208 template<class T>
209INLINE NodeConstPointerTo<T> &NodeConstPointerTo<T>::
210 operator = (NodeConstPointerTo<T> &&from) noexcept {
211 this->reassign(std::move(from));
212 return *this;
213}
214#endif // CPPPARSER
215
216#ifndef CPPPARSER
217/**
218 *
219 */
220 template<class T>
221INLINE const typename NodeConstPointerTo<T>::To &NodeConstPointerTo<T>::
222 operator *() const {
223 return *((To *)(this->_void_ptr));
224}
225#endif // CPPPARSER
226
227#ifndef CPPPARSER
228/**
229 *
230 */
231 template<class T>
232INLINE const typename NodeConstPointerTo<T>::To *NodeConstPointerTo<T>::
233 operator -> () const {
234 return (To *)(this->_void_ptr);
235}
236#endif // CPPPARSER
237
238#ifndef CPPPARSER
239/**
240 * We also have the typecast operator to automatically convert
241 * NodeConstPointerTo's to the required kind of actual pointer. This
242 * introduces ambiguities which the compiler will resolve one way or the
243 * other, but we don't care which way it goes because either will be correct.
244 */
245
246 template<class T>
247INLINE NodeConstPointerTo<T>::
248operator const T * () const {
249 return (To *)(this->_void_ptr);
250}
251#endif // CPPPARSER
252
253#ifndef CPPPARSER
254/**
255 * Returns an ordinary pointer instead of a NodeConstPointerTo. Useful to
256 * work around compiler problems, particularly for implicit upcasts.
257 */
258 template<class T>
259INLINE const typename NodeConstPointerTo<T>::To *NodeConstPointerTo<T>::
260 p() const {
261 return (To *)(this->_void_ptr);
262}
263#endif // CPPPARSER
264
265#ifndef CPPPARSER
266/**
267 *
268 */
269 template<class T>
270INLINE NodeConstPointerTo<T> &NodeConstPointerTo<T>::
271 operator = (const To *ptr) {
272 this->reassign((To *)ptr);
273 return *this;
274}
275#endif // CPPPARSER
276
277#ifndef CPPPARSER
278/**
279 *
280 */
281 template<class T>
282INLINE NodeConstPointerTo<T> &NodeConstPointerTo<T>::
283 operator = (const NodePointerTo<T> &copy) {
284 this->reassign((const NodePointerToBase<T> &)copy);
285 return *this;
286}
287#endif // CPPPARSER
288
289#ifndef CPPPARSER
290/**
291 *
292 */
293 template<class T>
294INLINE NodeConstPointerTo<T> &NodeConstPointerTo<T>::
295 operator = (const NodeConstPointerTo<T> &copy) {
296 this->reassign((const NodePointerToBase<T> &)copy);
297 return *this;
298}
299#endif // CPPPARSER
NodeConstPointerTo
A NodeConstPointerTo is similar to a NodePointerTo, except it keeps a const pointer to the thing.
Definition nodePointerTo.h:57
NodeConstPointerTo::p
const To * p() const
Returns an ordinary pointer instead of a NodeConstPointerTo.
Definition nodePointerTo.I:260
To
NodePointerTo
This implements the special NodePointerTo template class, which works just like PointerTo except it m...
Definition nodePointerTo.h:26
NodePointerTo::p
To * p() const
Returns an ordinary pointer instead of a NodePointerTo.
Definition nodePointerTo.I:103