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. More... | |
const Datagram & | get_datagram () const |
void | set_datagram (const Datagram &datagram) |
Sets the datagram that will be written when advance() is called. More... | |
void | set_opcode (FltOpcode opcode) |
Sets the opcode associated with the current record. More... | |
Datagram & | update_datagram () |
Returns a modifiable reference to the datagram associated with the current record. More... | |
FltError | write_instance_def (FltHeader *header, int instance_index) |
Ensures that the given instance definition has already been written to the file. More... | |
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. More... | |
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(), Datagram::get_length(), and write_record().
Referenced by FltHeader::get_trackplane(), FltBead::set_replicate_count(), update_datagram(), and FltRecord::write().
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.
References update_datagram().
Referenced by FltUnsupportedRecord::output(), and set_opcode().
void FltRecordWriter::set_opcode | ( | FltOpcode | opcode | ) |
Sets the opcode associated with the current record.
Definition at line 55 of file fltRecordWriter.cxx.
References set_datagram().
Referenced by FltLocalVertexPool::build_record(), FltTransformRotateAboutEdge::get_angle(), FltTransformRotateAboutPoint::get_angle(), FltTransformRotateScale::get_angle(), FltTransformTranslate::get_from(), FltHeader::get_trackplane(), FltVectorRecord::get_vector(), FltTransformScale::has_center(), FltUnsupportedRecord::output(), FltVertexList::output(), FltTransformPut::set(), FltTransformGeneralMatrix::set_matrix(), FltExternalReference::set_ref_filename(), FltBead::set_replicate_count(), FltVertex::set_rgb(), FltInstanceRef::write(), and FltTexture::write_attr_data().
Datagram & FltRecordWriter::update_datagram | ( | ) |
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.
References advance().
Referenced by FltLocalVertexPool::build_record(), FltGeometry::get_alt_rgb(), FltTransformRotateAboutEdge::get_angle(), FltTransformRotateAboutPoint::get_angle(), FltTransformRotateScale::get_angle(), FltTransformTranslate::get_from(), FltHeader::get_trackplane(), FltVectorRecord::get_vector(), FltTransformScale::has_center(), FltBeadID::output(), FltVertexList::output(), FltTransformPut::set(), set_datagram(), FltTransformGeneralMatrix::set_matrix(), FltExternalReference::set_ref_filename(), FltBead::set_replicate_count(), FltVertex::set_rgb(), FltInstanceRef::write(), and FltTexture::write_attr_data().
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().
Referenced by FltInstanceRef::write(), and write_record().
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 FltRecordReader::advance(), and write_instance_def().
Referenced by advance(), FltHeader::get_trackplane(), FltBeadID::output(), and FltRecord::write().