Panda3D
|
00001 // Filename: weakPointerToVoid.h 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 #ifndef WEAKPOINTERTOVOID_H 00016 #define WEAKPOINTERTOVOID_H 00017 00018 #include "pandabase.h" 00019 #include "pointerToVoid.h" 00020 #include "weakPointerCallback.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : WeakPointerToVoid 00024 // Description : This is the specialization of PointerToVoid for weak 00025 // pointers. It needs an additional flag to indicate 00026 // that the pointer has been deleted. 00027 //////////////////////////////////////////////////////////////////// 00028 class EXPCL_PANDAEXPRESS WeakPointerToVoid : public PointerToVoid { 00029 protected: 00030 INLINE WeakPointerToVoid(); 00031 INLINE ~WeakPointerToVoid(); 00032 00033 public: 00034 INLINE void mark_deleted(); 00035 00036 INLINE void set_callback(WeakPointerCallback *callback); 00037 INLINE WeakPointerCallback *get_callback() const; 00038 00039 PUBLISHED: 00040 INLINE bool was_deleted() const; 00041 INLINE bool is_valid_pointer() const; 00042 00043 protected: 00044 bool _ptr_was_deleted; 00045 WeakPointerCallback *_callback; 00046 }; 00047 00048 #include "weakPointerToVoid.I" 00049 00050 #endif