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 */
18template<class T>
20NodePointerTo(To *ptr) : NodePointerToBase<T>(ptr) {
21}
22#endif // CPPPARSER
23
24#ifndef CPPPARSER
25/**
26 *
27 */
28template<class T>
31 NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
32{
33}
34#endif // CPPPARSER
35
36#ifndef CPPPARSER
37/**
38 *
39 */
40template<class T>
42NodePointerTo(NodePointerTo<T> &&from) noexcept :
44{
45}
46#endif // CPPPARSER
47
48#ifndef CPPPARSER
49/**
50 *
51 */
52template<class T>
54operator = (NodePointerTo<T> &&from) noexcept {
55 this->reassign(std::move(from));
56 return *this;
57}
58#endif // CPPPARSER
59
60#ifndef CPPPARSER
61/**
62 *
63 */
64template<class T>
65INLINE typename NodePointerTo<T>::To &NodePointerTo<T>::
66operator *() const {
67 return *((To *)(this->_void_ptr));
68}
69#endif // CPPPARSER
70
71#ifndef CPPPARSER
72/**
73 *
74 */
75template<class T>
76INLINE typename NodePointerTo<T>::To *NodePointerTo<T>::
77operator -> () 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 */
89template<class 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 */
101template<class T>
102INLINE typename NodePointerTo<T>::To *NodePointerTo<T>::
103p() const {
104 return (To *)(this->_void_ptr);
105}
106#endif // CPPPARSER
107
108#ifndef CPPPARSER
109/**
110 *
111 */
112template<class T>
114operator = (To *ptr) {
115 this->reassign(ptr);
116 return *this;
117}
118#endif // CPPPARSER
119
120#ifndef CPPPARSER
121/**
122 *
123 */
124template<class T>
126operator = (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 */
136template<class T>
138NodeConstPointerTo(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 */
148template<class T>
151 NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
152{
153}
154#endif // CPPPARSER
155
156#ifndef CPPPARSER
157/**
158 *
159 */
160template<class T>
163 NodePointerToBase<T>((const NodePointerToBase<T> &)copy)
164{
165}
166#endif // CPPPARSER
167
168#ifndef CPPPARSER
169/**
170 *
171 */
172template<class T>
174NodeConstPointerTo(NodePointerTo<T> &&from) noexcept :
176{
177}
178#endif // CPPPARSER
179
180#ifndef CPPPARSER
181/**
182 *
183 */
184template<class T>
188{
189}
190#endif // CPPPARSER
191
192#ifndef CPPPARSER
193/**
194 *
195 */
196template<class T>
198operator = (NodePointerTo<T> &&from) noexcept {
199 this->reassign(std::move(from));
200 return *this;
201}
202#endif // CPPPARSER
203
204#ifndef CPPPARSER
205/**
206 *
207 */
208template<class T>
210operator = (NodeConstPointerTo<T> &&from) noexcept {
211 this->reassign(std::move(from));
212 return *this;
213}
214#endif // CPPPARSER
215
216#ifndef CPPPARSER
217/**
218 *
219 */
220template<class T>
221INLINE const typename NodeConstPointerTo<T>::To &NodeConstPointerTo<T>::
222operator *() const {
223 return *((To *)(this->_void_ptr));
224}
225#endif // CPPPARSER
226
227#ifndef CPPPARSER
228/**
229 *
230 */
231template<class T>
232INLINE const typename NodeConstPointerTo<T>::To *NodeConstPointerTo<T>::
233operator -> () 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
246template<class 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 */
258template<class T>
259INLINE const typename NodeConstPointerTo<T>::To *NodeConstPointerTo<T>::
260p() const {
261 return (To *)(this->_void_ptr);
262}
263#endif // CPPPARSER
264
265#ifndef CPPPARSER
266/**
267 *
268 */
269template<class T>
271operator = (const To *ptr) {
272 this->reassign((To *)ptr);
273 return *this;
274}
275#endif // CPPPARSER
276
277#ifndef CPPPARSER
278/**
279 *
280 */
281template<class T>
283operator = (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 */
293template<class T>
296 this->reassign((const NodePointerToBase<T> &)copy);
297 return *this;
298}
299#endif // CPPPARSER
A NodeConstPointerTo is similar to a NodePointerTo, except it keeps a const pointer to the thing.
const To * p() const
Returns an ordinary pointer instead of a NodeConstPointerTo.
This is similar to PointerToBase, but it manages objects of type NodeReferenceCount or NodeCachedRefe...
This implements the special NodePointerTo template class, which works just like PointerTo except it m...
To * p() const
Returns an ordinary pointer instead of a NodePointerTo.