00001 // Filename: typedWritable.cxx 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 #include "typedWritable.h" 00020 00021 TypeHandle TypedWritable::_type_handle; 00022 TypedWritable* const TypedWritable::Null = (TypedWritable*)0L; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Function: TypedWritable::Destructor 00026 // Access: Public, Virtual 00027 // Description: 00028 //////////////////////////////////////////////////////////////////// 00029 TypedWritable::~TypedWritable() { 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: TypedWritable::write_datagram 00034 // Access: Public, Virtual 00035 // Description: Writes the contents of this object to the datagram 00036 // for shipping out to a Bam file. 00037 //////////////////////////////////////////////////////////////////// 00038 void TypedWritable:: 00039 write_datagram(BamWriter *, Datagram &) { 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: TypedWritable::complete_pointers 00044 // Access: Public, Virtual 00045 // Description: Receives an array of pointers, one for each time 00046 // manager->read_pointer() was called in fillin(). 00047 // Returns the number of pointers processed. 00048 // 00049 // This is the callback function that is made by the 00050 // BamReader at some later point, after all of the 00051 // required pointers have been filled in. It is 00052 // necessary because there might be forward references 00053 // in a bam file; when we call read_pointer() in 00054 // fillin(), the object may not have been read from the 00055 // file yet, so we do not have a pointer available at 00056 // that time. Thus, instead of returning a pointer, 00057 // read_pointer() simply reserves a later callback. 00058 // This function provides that callback. The calling 00059 // object is responsible for keeping track of the number 00060 // of times it called read_pointer() and extracting the 00061 // same number of pointers out of the supplied vector, 00062 // and storing them appropriately within the object. 00063 //////////////////////////////////////////////////////////////////// 00064 int TypedWritable:: 00065 complete_pointers(TypedWritable **, BamReader *) { 00066 return 0; 00067 } 00068 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: TypedWritable::finalize 00072 // Access: Public, Virtual 00073 // Description: Called by the BamReader to perform any final actions 00074 // needed for setting up the object after all objects 00075 // have been read and all pointers have been completed. 00076 //////////////////////////////////////////////////////////////////// 00077 void TypedWritable:: 00078 finalize() { 00079 } 00080 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: TypedWritable::fillin 00084 // Access: Protected 00085 // Description: This internal function is intended to be called by 00086 // each class's make_from_bam() method to read in all of 00087 // the relevant data from the BamFile for the new 00088 // object. 00089 // 00090 // It is defined at the TypedWritable level so that 00091 // derived classes may call up the inheritance chain 00092 // from their own fillin() method. 00093 //////////////////////////////////////////////////////////////////// 00094 void TypedWritable:: 00095 fillin(DatagramIterator &, BamReader *) { 00096 } 00097