TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ReferenceCount.h
Go to the documentation of this file.
1 
11 #ifndef G3D_ReferenceCount_h
12 #define G3D_ReferenceCount_h
13 
14 #include "G3D/platform.h"
15 #include "G3D/debug.h"
16 #include "G3D/AtomicInt32.h"
17 
18 #define USE_SHARED_PTR
19 
20 #define ReferenceCountedPointer shared_ptr
21 #define WeakReferenceCountedPointer weak_ptr
22 namespace G3D {
23 
24 class ReferenceCountedObject : public enable_shared_from_this<ReferenceCountedObject> {
25 public:
27 };
28 
29 } // namespace
30 
31 namespace G3D {
32 
33 template<class T>
34 bool isNull(const ReferenceCountedPointer<T>& ptr) {
35  return ! ptr;
36 }
37 
38 template<class T>
39 bool notNull(const ReferenceCountedPointer<T>& ptr) {
40  return (bool)ptr;
41 }
42 
43 template<class T>
44 bool isNull(const T* ptr) {
45  return ptr == NULL;
46 }
47 
48 template<class T>
49 bool notNull(const T* ptr) {
50  return ptr != NULL;
51 }
52 
53 } // namespace
54 
55 #endif
56 
bool notNull(const Pointer< T > &p)
Definition: Pointer.h:350
Definition: AABox.h:25
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: ReferenceCount.h:24
virtual ~ReferenceCountedObject()
Definition: ReferenceCount.h:26
bool isNull(const Pointer< T > &p)
Definition: Pointer.h:345