BamFile
from panda3d.core import BamFile
- class BamFile
Bases:
BamEnums
The principle public interface to reading and writing Bam disk files. See also BamReader and BamWriter, the more general implementation of this class.
Bam files are most often used to store scene graphs or subgraphs, and by convention they are given filenames ending in the extension “.bam” when they are used for this purpose. However, a Bam file may store any arbitrary list of TypedWritable objects; in this more general usage, they are given filenames ending in “.boo” to differentiate them from the more common scene graph files.
Inheritance diagram
- __init__(*args, **kwargs)
- file_endian
- file_stdfloat_double
- file_version
- getCurrentMajorVer()
C++ Interface: get_current_major_ver(const BamFile self)
- /**
Returns the system current major version number. This is the version
number that will be assigned to any generated Bam files.
*/
- getCurrentMinorVer()
C++ Interface: get_current_minor_ver(const BamFile self)
- /**
Returns the system current minor version number. This is the version
number that will be assigned to any generated Bam files.
*/
- getFileEndian()
C++ Interface: get_file_endian(BamFile self)
- /**
Returns the endian preference indicated by the Bam file currently being
read or written.
*/
- getFileMajorVer()
C++ Interface: get_file_major_ver(const BamFile self)
- /**
Returns the major version number of the file currently being read, or the
system current major version number if no file is currently open for
reading.
*/
- getFileMinorVer()
C++ Interface: get_file_minor_ver(const BamFile self)
- /**
Returns the minor version number of the file currently being read, or the
system current minor version number if no file is currently open for
reading.
*/
- getFileStdfloatDouble()
C++ Interface: get_file_stdfloat_double(BamFile self)
- /**
Returns true if the file stores all “standard” floats as 64-bit doubles, or
false if they are 32-bit floats.
*/
- getReader()
C++ Interface: get_reader(const BamFile self)
- /**
Returns the BamReader in charge of performing the read operations. This
will return NULL unless open_read() was called.
*/
- getWriter()
C++ Interface: get_writer(const BamFile self)
- /**
Returns the BamWriter in charge of performing the write operations. This
will return NULL unless open_write() was called.
*/
- get_current_major_ver()
C++ Interface: get_current_major_ver(const BamFile self)
- /**
Returns the system current major version number. This is the version
number that will be assigned to any generated Bam files.
*/
- get_current_minor_ver()
C++ Interface: get_current_minor_ver(const BamFile self)
- /**
Returns the system current minor version number. This is the version
number that will be assigned to any generated Bam files.
*/
- get_file_endian()
C++ Interface: get_file_endian(BamFile self)
- /**
Returns the endian preference indicated by the Bam file currently being
read or written.
*/
- get_file_major_ver()
C++ Interface: get_file_major_ver(const BamFile self)
- /**
Returns the major version number of the file currently being read, or the
system current major version number if no file is currently open for
reading.
*/
- get_file_minor_ver()
C++ Interface: get_file_minor_ver(const BamFile self)
- /**
Returns the minor version number of the file currently being read, or the
system current minor version number if no file is currently open for
reading.
*/
- get_file_stdfloat_double()
C++ Interface: get_file_stdfloat_double(BamFile self)
- /**
Returns true if the file stores all “standard” floats as 64-bit doubles, or
false if they are 32-bit floats.
*/
- get_reader()
C++ Interface: get_reader(const BamFile self)
- /**
Returns the BamReader in charge of performing the read operations. This
will return NULL unless open_read() was called.
*/
- get_writer()
C++ Interface: get_writer(const BamFile self)
- /**
Returns the BamWriter in charge of performing the write operations. This
will return NULL unless open_write() was called.
*/
- isEof()
C++ Interface: is_eof(BamFile self)
- /**
Returns true if the reader has reached end-of-file, false otherwise. This
call is only valid after a call to read_object().
*/
- isValidRead()
C++ Interface: is_valid_read(BamFile self)
- /**
Returns true if the Bam file is open and ready for reading with no errors
so far detected, or false otherwise.
*/
- isValidWrite()
C++ Interface: is_valid_write(BamFile self)
- /**
Returns true if the Bam file is open and ready for writing with no errors
so far detected, or false otherwise.
*/
- is_eof()
C++ Interface: is_eof(BamFile self)
- /**
Returns true if the reader has reached end-of-file, false otherwise. This
call is only valid after a call to read_object().
*/
- is_valid_read()
C++ Interface: is_valid_read(BamFile self)
- /**
Returns true if the Bam file is open and ready for reading with no errors
so far detected, or false otherwise.
*/
- is_valid_write()
C++ Interface: is_valid_write(BamFile self)
- /**
Returns true if the Bam file is open and ready for writing with no errors
so far detected, or false otherwise.
*/
- openRead()
C++ Interface: open_read(const BamFile self, istream in, str bam_filename, bool report_errors)
- openWrite()
C++ Interface: open_write(const BamFile self, ostream out, str bam_filename, bool report_errors)
- /**
Attempts to open the indicated file for writing. If another file by the
same name already exists, it will be silently removed. Returns true if
successful, false otherwise.
*/
- /**
Attempts to open the indicated stream for writing. The filename is just
for information purposes only. Returns true if successful, false on error.
*/
- open_read()
C++ Interface: open_read(const BamFile self, istream in, str bam_filename, bool report_errors)
- open_write()
C++ Interface: open_write(const BamFile self, ostream out, str bam_filename, bool report_errors)
- /**
Attempts to open the indicated file for writing. If another file by the
same name already exists, it will be silently removed. Returns true if
successful, false otherwise.
*/
- /**
Attempts to open the indicated stream for writing. The filename is just
for information purposes only. Returns true if successful, false on error.
*/
- readNode()
C++ Interface: read_node(const BamFile self, bool report_errors)
- /**
Although the bam file format is general enough to store a list of objects
of arbitrary type, bam files on disk usually contain just one object, a
PandaNode that is the root of a scene graph. (Bam files that store other
kinds of things are usually given the extension “boo”, for “binary other
objects”, to differentiate them from the normal scene graph type file.)
This is a convenience method for when you believe you are reading a scene
graph bam file. It reads the one PandaNode and returns it. It also calls
resolve() to fully resolve the object, since we expect this will be the
only object in the file.
If the bam file contains something other than a PandaNode, an error is
printed and NULL is returned.
*/
- readObject()
C++ Interface: read_object(const BamFile self)
- /**
Reads and returns the next object from the Bam file, or NULL if the end of
the file has been reached, or if there is an error condition. Use is_eof()
to differentiate these two cases.
The pointers returned by this method will not be valid for use until
resolve() is subsequently called.
*/
- read_node()
C++ Interface: read_node(const BamFile self, bool report_errors)
- /**
Although the bam file format is general enough to store a list of objects
of arbitrary type, bam files on disk usually contain just one object, a
PandaNode that is the root of a scene graph. (Bam files that store other
kinds of things are usually given the extension “boo”, for “binary other
objects”, to differentiate them from the normal scene graph type file.)
This is a convenience method for when you believe you are reading a scene
graph bam file. It reads the one PandaNode and returns it. It also calls
resolve() to fully resolve the object, since we expect this will be the
only object in the file.
If the bam file contains something other than a PandaNode, an error is
printed and NULL is returned.
*/
- read_object()
C++ Interface: read_object(const BamFile self)
- /**
Reads and returns the next object from the Bam file, or NULL if the end of
the file has been reached, or if there is an error condition. Use is_eof()
to differentiate these two cases.
The pointers returned by this method will not be valid for use until
resolve() is subsequently called.
*/
- reader
- resolve()
C++ Interface: resolve(const BamFile self)
- /**
This must be called after one or more objects have been read via calls to
read_object() in order to resolve all internal pointer references in the
objects read and make all the pointers valid. It returns true if all
objects are successfully resolved, or false if some have not been (in which
case you must call resolve() again later).
*/
- writeObject()
C++ Interface: write_object(const BamFile self, const TypedWritable object)
- /**
Writes the indicated object to the Bam file. Returns true if successful,
false on error.
*/
- write_object()
C++ Interface: write_object(const BamFile self, const TypedWritable object)
- /**
Writes the indicated object to the Bam file. Returns true if successful,
false on error.
*/
- writer