Panda3D
|
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly. More...
#include "fltRecordWriter.h"
Public Member Functions | |
FltRecordWriter (ostream &out) | |
FltError | advance () |
Writes the current record to the flt file, and resets the current record to receive new data. | |
const Datagram & | get_datagram () const |
void | set_datagram (const Datagram &datagram) |
Sets the datagram that will be written when advance() is called. | |
void | set_opcode (FltOpcode opcode) |
Sets the opcode associated with the current record. | |
Datagram & | update_datagram () |
Returns a modifiable reference to the datagram associated with the current record. | |
FltError | write_instance_def (FltHeader *header, int instance_index) |
Ensures that the given instance definition has already been written to the file. | |
FltError | write_record (FltOpcode opcode, const Datagram &datagram=Datagram()) |
A convenience function to quickly write a simple record that consists of an opcode and possibly a datagram. |
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
Definition at line 33 of file fltRecordWriter.h.
FltError FltRecordWriter::advance | ( | ) |
Writes the current record to the flt file, and resets the current record to receive new data.
Returns FE_ok on success, or something else on error.
Definition at line 92 of file fltRecordWriter.cxx.
References Datagram::add_be_int16(), Datagram::clear(), Datagram::get_data(), and Datagram::get_length().
Referenced by FltMesh::write_ancillary(), write_record(), and FltRecord::write_record_and_children().
void FltRecordWriter::set_datagram | ( | const Datagram & | datagram | ) |
Sets the datagram that will be written when advance() is called.
Definition at line 66 of file fltRecordWriter.cxx.
Referenced by FltUnsupportedRecord::build_record().
void FltRecordWriter::set_opcode | ( | FltOpcode | opcode | ) |
Sets the opcode associated with the current record.
Definition at line 55 of file fltRecordWriter.cxx.
Referenced by FltFace::build_record(), FltUnsupportedRecord::build_record(), FltTransformGeneralMatrix::build_record(), FltInstanceDefinition::build_record(), FltMesh::build_record(), FltVectorRecord::build_record(), FltTransformTranslate::build_record(), FltVertexList::build_record(), FltTransformScale::build_record(), FltInstanceRef::build_record(), FltTransformRotateAboutPoint::build_record(), FltGroup::build_record(), FltTransformRotateAboutEdge::build_record(), FltLOD::build_record(), FltObject::build_record(), FltMaterial::build_record(), FltMeshPrimitive::build_record(), FltCurve::build_record(), FltTransformRotateScale::build_record(), FltExternalReference::build_record(), FltLocalVertexPool::build_record(), FltTransformPut::build_record(), FltLightSourceDefinition::build_record(), FltVertex::build_record(), FltTexture::build_record(), and FltHeader::build_record().
Returns a modifiable reference to the datagram associated with the current record.
This datagram should then be stuffed with data corresponding to the data in the record, in preparation for calling advance() to write the data.
Definition at line 80 of file fltRecordWriter.cxx.
Referenced by FltTransformGeneralMatrix::build_record(), FltBeadID::build_record(), FltInstanceDefinition::build_record(), FltMesh::build_record(), FltVectorRecord::build_record(), FltTransformTranslate::build_record(), FltVertexList::build_record(), FltInstanceRef::build_record(), FltTransformScale::build_record(), FltGroup::build_record(), FltTransformRotateAboutEdge::build_record(), FltTransformRotateAboutPoint::build_record(), FltLOD::build_record(), FltObject::build_record(), FltMaterial::build_record(), FltMeshPrimitive::build_record(), FltCurve::build_record(), FltTransformRotateScale::build_record(), FltExternalReference::build_record(), FltLocalVertexPool::build_record(), FltTransformPut::build_record(), FltLightSourceDefinition::build_record(), FltVertex::build_record(), FltGeometry::build_record(), FltTexture::build_record(), and FltHeader::build_record().
FltError FltRecordWriter::write_instance_def | ( | FltHeader * | header, |
int | instance_index | ||
) |
Ensures that the given instance definition has already been written to the file.
If it has not, writes it now.
Definition at line 159 of file fltRecordWriter.cxx.
References FltHeader::get_instance(), and FltRecord::write_record_and_children().
Referenced by FltInstanceRef::write_record_and_children().
FltError FltRecordWriter::write_record | ( | FltOpcode | opcode, |
const Datagram & | datagram = Datagram() |
||
) |
A convenience function to quickly write a simple record that consists of an opcode and possibly a datagram.
Definition at line 145 of file fltRecordWriter.cxx.
References advance().
Referenced by FltBeadID::write_ancillary(), FltRecord::write_ancillary(), and FltRecord::write_record_and_children().