Panda3D
|
00001 // Filename: typedReferenceCount.h 00002 // Created by: drose (08Feb99) 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 TYPEDREFERENCECOUNT_H 00016 #define TYPEDREFERENCECOUNT_H 00017 00018 #include "pandabase.h" 00019 00020 #include "typedObject.h" 00021 #include "referenceCount.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : TypedReferenceCount 00025 // Description : A base class for things which need to inherit from 00026 // both TypedObject and from ReferenceCount. It's 00027 // convenient to define this intermediate base class 00028 // instead of multiply inheriting from the two classes 00029 // each time they are needed, so that we can sensibly 00030 // pass around pointers to things which are both 00031 // TypedObjects and ReferenceCounters. 00032 // 00033 // See also TypedObject for detailed instructions. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDAEXPRESS TypedReferenceCount : public TypedObject, public ReferenceCount { 00036 public: 00037 INLINE TypedReferenceCount(); 00038 INLINE TypedReferenceCount(const TypedReferenceCount ©); 00039 INLINE void operator = (const TypedReferenceCount ©); 00040 00041 public: 00042 virtual TypeHandle get_type() const { 00043 return get_class_type(); 00044 } 00045 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00046 00047 PUBLISHED: 00048 static TypeHandle get_class_type() { 00049 return _type_handle; 00050 } 00051 00052 public: 00053 static void init_type() { 00054 TypedObject::init_type(); 00055 ReferenceCount::init_type(); 00056 register_type(_type_handle, "TypedReferenceCount", 00057 TypedObject::get_class_type(), 00058 ReferenceCount::get_class_type()); 00059 } 00060 00061 private: 00062 static TypeHandle _type_handle; 00063 }; 00064 00065 #include "typedReferenceCount.I" 00066 00067 #endif 00068