00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 INLINE BamReaderAuxData::
00022 BamReaderAuxData() {
00023 }
00024
00025
00026
00027
00028
00029
00030
00031 INLINE DatagramGenerator *BamReader::
00032 get_source() {
00033 return _source;
00034 }
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 INLINE const Filename &BamReader::
00045 get_filename() const {
00046 if (_source != (DatagramGenerator *)NULL) {
00047 return _source->get_filename();
00048 }
00049 static const Filename empty_filename;
00050 return empty_filename;
00051 }
00052
00053
00054
00055
00056
00057
00058
00059 INLINE const LoaderOptions &BamReader::
00060 get_loader_options() const {
00061 return _loader_options;
00062 }
00063
00064
00065
00066
00067
00068
00069 INLINE void BamReader::
00070 set_loader_options(const LoaderOptions &options) {
00071 _loader_options = options;
00072 }
00073
00074
00075
00076
00077
00078
00079
00080
00081 INLINE bool BamReader::
00082 is_eof() const {
00083 nassertr(_source != NULL, true);
00084 return _source->is_eof();
00085 }
00086
00087
00088
00089
00090
00091
00092
00093 INLINE int BamReader::
00094 get_file_major_ver() const {
00095 return _file_major;
00096 }
00097
00098
00099
00100
00101
00102
00103
00104 INLINE int BamReader::
00105 get_file_minor_ver() const {
00106 return _file_minor;
00107 }
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 INLINE BamReader::BamEndian BamReader::
00119 get_file_endian() const {
00120 return _file_endian;
00121 }
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 INLINE bool BamReader::
00132 get_file_stdfloat_double() const {
00133 return _file_stdfloat_double;
00134 }
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 INLINE int BamReader::
00145 get_current_major_ver() const {
00146 return _cur_major;
00147 }
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 INLINE int BamReader::
00158 get_current_minor_ver() const {
00159 return _cur_minor;
00160 }
00161
00162
00163
00164
00165
00166
00167
00168
00169 INLINE const FileReference *BamReader::
00170 get_file() {
00171 nassertr(_source != NULL, NULL);
00172 return _source->get_file();
00173 }
00174
00175
00176
00177
00178
00179
00180
00181
00182 INLINE VirtualFile *BamReader::
00183 get_vfile() {
00184 nassertr(_source != NULL, NULL);
00185 return _source->get_vfile();
00186 }
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200 INLINE streampos BamReader::
00201 get_file_pos() {
00202 nassertr(_source != NULL, 0);
00203 return _source->get_file_pos();
00204 }
00205
00206
00207
00208
00209
00210
00211
00212 INLINE WritableFactory *BamReader::
00213 get_factory() {
00214 if (_factory == (WritableFactory *)NULL) {
00215 create_factory();
00216 }
00217 return _factory;
00218 }
00219
00220
00221
00222
00223
00224
00225
00226 INLINE void BamReader::
00227 create_factory() {
00228 _factory = new WritableFactory;
00229 }
00230
00231
00232
00233
00234
00235
00236
00237 INLINE bool BamReader::
00238 get_datagram(Datagram &datagram) {
00239 nassertr(_source != NULL, false);
00240 if (_source->is_error()) {
00241 return false;
00242 }
00243
00244 if (!_source->get_datagram(datagram)) {
00245 return false;
00246 }
00247
00248 datagram.set_stdfloat_double(_file_stdfloat_double);
00249 return true;
00250 }
00251
00252
00253
00254
00255
00256
00257 INLINE BamReader::AuxData::
00258 AuxData() {
00259 }
00260
00261
00262
00263
00264
00265
00266 INLINE BamReader::CreatedObj::
00267 CreatedObj() :
00268 _created(false),
00269 _ptr(NULL),
00270 _ref_ptr(NULL),
00271 _change_this(NULL),
00272 _change_this_ref(NULL)
00273 {
00274 }
00275
00276
00277
00278
00279
00280
00281 INLINE BamReader::CreatedObj::
00282 ~CreatedObj() {
00283 set_ptr(NULL, NULL);
00284 }
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301 INLINE void BamReader::CreatedObj::
00302 set_ptr(TypedWritable *ptr, ReferenceCount *ref_ptr) {
00303 if (_ptr != ptr) {
00304 if (_ref_ptr != NULL) {
00305 nassertv(_ref_ptr != ref_ptr);
00306 unref_delete(_ref_ptr);
00307 }
00308
00309 _ptr = ptr;
00310 _ref_ptr = ref_ptr;
00311
00312 if (_ref_ptr != NULL) {
00313 _ref_ptr->ref();
00314 }
00315 } else {
00316 nassertv(_ref_ptr == ref_ptr);
00317 }
00318 }
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329 INLINE void
00330 parse_params(const FactoryParams ¶ms,
00331 DatagramIterator &scan, BamReader *&manager) {
00332 BamReaderParam *param = DCAST(BamReaderParam, params.get_param(0));
00333
00334 scan = param->get_iterator();
00335 manager = param->get_manager();
00336 }
00337