42 #define READ_PTA(Manager, source, Read_func, array) \
45 if ((t = Manager->get_pta(source)) == nullptr) \
47 array = Read_func(Manager, source); \
48 Manager->register_pta(array.get_void_ptr()); \
52 array.set_void_ptr(t); \
67 return get_class_type();
69 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
75 static void init_type() {
76 TypedReferenceCount::init_type();
78 TypedReferenceCount::get_class_type());
130 INLINE
const Filename &get_filename()
const;
133 INLINE
void set_loader_options(
const LoaderOptions &options);
138 INLINE
bool is_eof()
const;
143 INLINE
int get_file_major_ver()
const;
144 INLINE
int get_file_minor_ver()
const;
145 INLINE
BamEndian get_file_endian()
const;
146 INLINE
bool get_file_stdfloat_double()
const;
148 INLINE
int get_current_major_ver()
const;
149 INLINE
int get_current_minor_ver()
const;
151 EXTENSION(PyObject *get_file_version()
const);
154 MAKE_PROPERTY(source, get_source, set_source);
155 MAKE_PROPERTY(filename, get_filename);
156 MAKE_PROPERTY(loader_options, get_loader_options, set_loader_options);
158 MAKE_PROPERTY(file_version, get_file_version);
159 MAKE_PROPERTY(file_endian, get_file_endian);
160 MAKE_PROPERTY(file_stdfloat_double, get_file_stdfloat_double);
175 void set_int_tag(
const std::string &tag,
int value);
176 int get_int_tag(
const std::string &tag)
const;
185 void register_change_this(ChangeThisFunc func,
TypedWritable *whom);
191 void register_pta(
void *ptr);
197 INLINE std::streampos get_file_pos();
200 INLINE
static void register_factory(
TypeHandle type, WritableFactory::CreateFunc *func,
201 void *user_data =
nullptr);
205 EXTENSION(
static void register_factory(
TypeHandle handle, PyObject *func));
208 INLINE
static void create_factory();
211 class PointerReference;
217 bool resolve_object_pointers(
TypedWritable *
object, PointerReference &pref);
218 bool resolve_cycler_pointers(
PipelineCyclerBase *cycler,
const vector_int &pointer_ids,
219 bool require_fully_complete);
222 INLINE
bool get_datagram(
Datagram &datagram);
240 bool _long_object_id;
245 typedef phash_map<int, TypeHandle, int_hash> IndexMap;
255 INLINE ~CreatedObj();
262 ChangeThisFunc _change_this;
263 ChangeThisRefFunc _change_this_ref;
265 typedef phash_map<int, CreatedObj, int_hash> CreatedObjs;
266 CreatedObjs _created_objs;
271 CreatedObjs::iterator _now_creating;
277 typedef phash_map<const TypedWritable *, vector_int, pointer_hash> CreatedObjsByPointer;
278 CreatedObjsByPointer _created_objs_by_pointer;
284 typedef phash_map<PipelineCyclerBase *, vector_int, pointer_hash> CyclerPointers;
287 class PointerReference {
290 CyclerPointers _cycler_pointers;
294 typedef phash_map<int, PointerReference, int_hash> ObjectPointers;
295 ObjectPointers _object_pointers;
300 int _num_extra_objects;
309 typedef phash_set<TypedWritable *, pointer_hash> Finalize;
310 Finalize _finalize_list;
314 typedef phash_map<int, void *, int_hash> PTAMap;
322 FileDataRecords _file_data_records;
327 typedef phash_set<TypeHandle> NewTypes;
328 static NewTypes _new_types;
331 typedef pmap<std::string, PT(AuxData)> AuxDataNames;
332 typedef phash_map<TypedWritable *, AuxDataNames, pointer_hash> AuxDataTable;
333 AuxDataTable _aux_data;
335 int _file_major, _file_minor;
336 BamEndian _file_endian;
337 bool _file_stdfloat_double;
338 static const int _cur_major;
339 static const int _cur_minor;