00001 // Filename: bamReader.I 00002 // Created by: jason (12Jun00) 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: BamReader::is_eof 00022 // Access: Public 00023 // Description: Returns true if the reader has reached end-of-file, 00024 // false otherwise. This call is only valid after a 00025 // call to read_object(). 00026 //////////////////////////////////////////////////////////////////// 00027 INLINE bool BamReader:: 00028 is_eof() const { 00029 return _source->is_eof(); 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: BamReader::get_file_major_ver 00034 // Access: Public 00035 // Description: Returns the major version number of the Bam file 00036 // currently being read. 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE int BamReader:: 00039 get_file_major_ver() const { 00040 return _file_major; 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: BamReader::get_file_minor_ver 00045 // Access: Public 00046 // Description: Returns the minor version number of the Bam file 00047 // currently being read. 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE int BamReader:: 00050 get_file_minor_ver() const { 00051 return _file_minor; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: BamReader::get_current_major_ver 00056 // Access: Public 00057 // Description: Returns the major version number of Bam files 00058 // supported by the current code base. This must match 00059 // get_file_major_ver() in order to successfully read a 00060 // file. 00061 //////////////////////////////////////////////////////////////////// 00062 INLINE int BamReader:: 00063 get_current_major_ver() const { 00064 return _cur_major; 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: BamReader::get_current_minor_ver 00069 // Access: Public 00070 // Description: Returns the minor version number of Bam files 00071 // supported by the current code base. This must match 00072 // or exceed get_file_minor_ver() in order to 00073 // successfully read a file. 00074 //////////////////////////////////////////////////////////////////// 00075 INLINE int BamReader:: 00076 get_current_minor_ver() const { 00077 return _cur_minor; 00078 } 00079 00080 //////////////////////////////////////////////////////////////////// 00081 // Function: BamReader::get_factory 00082 // Access: Public, Static 00083 // Description: Returns the global WritableFactory for generating 00084 // TypedWritable objects 00085 //////////////////////////////////////////////////////////////////// 00086 INLINE WritableFactory* BamReader:: 00087 get_factory() { 00088 if (_factory == NullFactory) 00089 create_factory(); 00090 return _factory; 00091 } 00092 00093 //////////////////////////////////////////////////////////////////// 00094 // Function: BamReader::create_factory 00095 // Access: Private, Static 00096 // Description: Creates a new WritableFactory for generating 00097 // TypedWritable objects 00098 //////////////////////////////////////////////////////////////////// 00099 INLINE void BamReader:: 00100 create_factory() { 00101 _factory = new WritableFactory; 00102 } 00103 00104 //////////////////////////////////////////////////////////////////// 00105 // Function: parse_params 00106 // Access: Private, Static 00107 // Description: Takes in a FactoryParams, passed from a WritableFactory 00108 // into any TypedWritable's make function, and parses 00109 // out the datagram that contatins the data it needs to 00110 // construct itself, and parses out the pointer to the 00111 // managing BamReader object 00112 //////////////////////////////////////////////////////////////////// 00113 INLINE void 00114 parse_params(const FactoryParams ¶ms, 00115 DatagramIterator &scan, BamReader *&manager) { 00116 BamReaderParam *param = DCAST(BamReaderParam, params.get_param(0)); 00117 00118 scan = param->get_iterator(); 00119 manager = param->get_manager(); 00120 }