Panda3D

pointerToVoid.I

00001 // Filename: pointerToVoid.I
00002 // Created by:  drose (27Sep04)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: PointerToVoid::Constructor
00018 //       Access: Protected
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE PointerToVoid::
00022 PointerToVoid() {
00023   _void_ptr = (void *)NULL;
00024 }
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //     Function: PointerToVoid::Destructor
00028 //       Access: Protected
00029 //  Description:
00030 ////////////////////////////////////////////////////////////////////
00031 INLINE PointerToVoid::
00032 ~PointerToVoid() {
00033   nassertv(_void_ptr == (void *)NULL);
00034 }
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //     Function: PointerToVoid::Copy Constructor
00038 //       Access: Private
00039 //  Description: Don't use this constructor.
00040 ////////////////////////////////////////////////////////////////////
00041 INLINE PointerToVoid::
00042 PointerToVoid(const PointerToVoid &) {
00043   nassertv(false);
00044 }
00045 
00046 ////////////////////////////////////////////////////////////////////
00047 //     Function: PointerToVoid::is_null
00048 //       Access: Published
00049 //  Description: Returns true if the PointerTo is a NULL pointer,
00050 //               false otherwise.  (Direct comparison to a NULL
00051 //               pointer also works.)
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE bool PointerToVoid::
00054 is_null() const {
00055   return (_void_ptr == (void *)NULL);
00056 }
00057 
00058 ////////////////////////////////////////////////////////////////////
00059 //     Function: PointerToVoid::get_hash
00060 //       Access: Public
00061 //  Description:
00062 ////////////////////////////////////////////////////////////////////
00063 INLINE size_t PointerToVoid::
00064 get_hash() const {
00065   return (size_t)_void_ptr;
00066 }
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //     Function: PointerToVoid::Less-than operator
00070 //       Access: Public
00071 //  Description:
00072 ////////////////////////////////////////////////////////////////////
00073 INLINE bool PointerToVoid::
00074 operator < (const void *other) const {
00075   return _void_ptr < other;
00076 }
00077 
00078 ////////////////////////////////////////////////////////////////////
00079 //     Function: PointerToVoid::Less-than operator
00080 //       Access: Public
00081 //  Description:
00082 ////////////////////////////////////////////////////////////////////
00083 INLINE bool PointerToVoid::
00084 operator < (const PointerToVoid &other) const {
00085   return _void_ptr < other._void_ptr;
00086 }
00087 
00088 ////////////////////////////////////////////////////////////////////
00089 //     Function: PointerToVoid::operator ==
00090 //       Access: Public
00091 //  Description:
00092 ////////////////////////////////////////////////////////////////////
00093 INLINE bool PointerToVoid::
00094 operator == (const PointerToVoid &other) const {
00095   return _void_ptr == other._void_ptr;
00096 }
00097 
00098 ////////////////////////////////////////////////////////////////////
00099 //     Function: PointerToVoid::operator !=
00100 //       Access: Public
00101 //  Description:
00102 ////////////////////////////////////////////////////////////////////
00103 INLINE bool PointerToVoid::
00104 operator != (const PointerToVoid &other) const {
00105   return _void_ptr != other._void_ptr;
00106 }
00107 
 All Classes Functions Variables Enumerations