Panda3D
|
00001 // Filename: typedWritableReferenceCount.h 00002 // Created by: jason (08Jun00) 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 TYPEDWRITABLEREFERENCECOUNT_H 00016 #define TYPEDWRITABLEREFERENCECOUNT_H 00017 00018 #include "pandabase.h" 00019 00020 #include "typedWritable.h" 00021 #include "referenceCount.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : TypedWritableReferenceCount 00025 // Description : A base class for things which need to inherit from 00026 // both TypedWritable 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 // TypedWritables and ReferenceCounters. 00032 // 00033 // See also TypedObject for detailed instructions. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA_PUTIL TypedWritableReferenceCount : public TypedWritable, public ReferenceCount { 00036 public: 00037 INLINE TypedWritableReferenceCount(); 00038 INLINE TypedWritableReferenceCount(const TypedWritableReferenceCount ©); 00039 INLINE void operator = (const TypedWritableReferenceCount ©); 00040 00041 virtual ReferenceCount *as_reference_count(); 00042 00043 PUBLISHED: 00044 static PT(TypedWritableReferenceCount) decode_from_bam_stream(const string &data, BamReader *reader = NULL); 00045 00046 public: 00047 virtual TypeHandle get_type() const { 00048 return get_class_type(); 00049 } 00050 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00051 static TypeHandle get_class_type() { 00052 return _type_handle; 00053 } 00054 static void init_type() { 00055 TypedWritable::init_type(); 00056 ReferenceCount::init_type(); 00057 register_type(_type_handle, "TypedWritableReferenceCount", 00058 TypedWritable::get_class_type(), 00059 ReferenceCount::get_class_type()); 00060 TypeRegistry::ptr()->record_alternate_name(_type_handle, 00061 "TypedWriteableReferenceCount"); 00062 } 00063 00064 private: 00065 static TypeHandle _type_handle; 00066 }; 00067 00068 #include "typedWritableReferenceCount.I" 00069 00070 #endif