Panda3D
pointerToVoid.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 pointerToVoid.I
10  * @author drose
11  * @date 2004-09-27
12  */
13 
14 /**
15  *
16  */
17 //INLINE PointerToVoid::
18 //~PointerToVoid() {
19 // nassertv(_void_ptr == nullptr);
20 //}
21 
22 /**
23  * Returns true if the PointerTo is a NULL pointer, false otherwise. (Direct
24  * comparison to a NULL pointer also works.)
25  */
26 constexpr bool PointerToVoid::
27 is_null() const {
28  return _void_ptr == nullptr;
29 }
30 
31 /**
32  *
33  */
34 INLINE size_t PointerToVoid::
35 get_hash() const {
36  return (size_t)_void_ptr;
37 }
38 
39 /**
40  *
41  */
42 INLINE bool PointerToVoid::
43 operator < (const void *other) const {
44  return _void_ptr < other;
45 }
46 
47 /**
48  *
49  */
50 INLINE bool PointerToVoid::
51 operator < (const PointerToVoid &other) const {
52  return _void_ptr < other._void_ptr;
53 }
54 
55 /**
56  *
57  */
58 INLINE bool PointerToVoid::
59 operator == (const PointerToVoid &other) const {
60  return _void_ptr == other._void_ptr;
61 }
62 
63 /**
64  *
65  */
66 INLINE bool PointerToVoid::
67 operator != (const PointerToVoid &other) const {
68  return _void_ptr != other._void_ptr;
69 }
70 
71 /**
72  * Swaps the contents of this PointerTo with the other, without touching the
73  * reference counts.
74  *
75  * For internal use only. Use the global swap() function instead.
76  */
77 INLINE void PointerToVoid::
78 swap(PointerToVoid &other) noexcept {
79  AtomicAdjust::Pointer temp = _void_ptr;
80  _void_ptr = other._void_ptr;
81  other._void_ptr = temp;
82 }
constexpr bool is_null() const
Returns true if the PointerTo is a NULL pointer, false otherwise.
Definition: pointerToVoid.I:27
void swap(PointerToVoid &other) noexcept
Swaps the contents of this PointerTo with the other, without touching the reference counts.
Definition: pointerToVoid.I:78
This is the non-template part of the base class for PointerTo and ConstPointerTo.
Definition: pointerToVoid.h:33