00001 // Filename: typedWritable.h 00002 // Created by: jason (08Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef __TYPED_WRITABLE_ 00020 #define __TYPED_WRITABLE_ 00021 00022 #include "typedObject.h" 00023 #include "vector_typedWritable.h" 00024 00025 class BamReader; 00026 class BamWriter; 00027 class Datagram; 00028 class DatagramIterator; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : TypedWritable 00032 // Description : Base class for objects that can be written to and 00033 // read from Bam files. 00034 //////////////////////////////////////////////////////////////////// 00035 00036 class EXPCL_PANDA TypedWritable : public TypedObject { 00037 public: 00038 static TypedWritable* const Null; 00039 00040 INLINE TypedWritable(); 00041 INLINE TypedWritable(const TypedWritable ©); 00042 INLINE void operator = (const TypedWritable ©); 00043 00044 virtual ~TypedWritable(); 00045 00046 virtual void write_datagram(BamWriter *, Datagram &); 00047 00048 virtual int complete_pointers(TypedWritable **p_list, BamReader *manager); 00049 00050 virtual void finalize(); 00051 00052 protected: 00053 void fillin(DatagramIterator &scan, BamReader *manager); 00054 00055 PUBLISHED: 00056 static TypeHandle get_class_type() { 00057 return _type_handle; 00058 } 00059 00060 public: 00061 static void init_type() { 00062 TypedObject::init_type(); 00063 register_type(_type_handle, "TypedWritable", 00064 TypedObject::get_class_type()); 00065 TypeRegistry::ptr()->record_alternate_name(_type_handle, "TypedWriteable"); 00066 } 00067 virtual TypeHandle get_type() const { 00068 return get_class_type(); 00069 } 00070 virtual TypeHandle force_init_type(void) { 00071 init_type(); 00072 return get_class_type(); 00073 } 00074 00075 private: 00076 static TypeHandle _type_handle; 00077 }; 00078 00079 #include "typedWritable.I" 00080 00081 #endif 00082 00083