Panda3D
|
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extracting the opcode from each one. More...
#include "fltRecordReader.h"
Public Member Functions | |
FltRecordReader (istream &in) | |
FltError | advance (bool ok_eof=false) |
Extracts the next record from the file. More... | |
bool | eof () const |
Returns true if end-of-file has been reached without error. More... | |
bool | error () const |
Returns true if some error has been encountered while reading (for instance, a truncated file). More... | |
const Datagram & | get_datagram () |
Returns the datagram representing the entire record, less the four-byte header. More... | |
DatagramIterator & | get_iterator () |
Returns an iterator suitable for extracting data from the current record. More... | |
FltOpcode | get_opcode () const |
Returns the opcode associated with the current record. More... | |
int | get_record_length () const |
Returns the entire length of the record, including the four-byte header. More... | |
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extracting the opcode from each one.
It remembers where it is in the file and what the current record is.
Definition at line 34 of file fltRecordReader.h.
FltError FltRecordReader::advance | ( | bool | ok_eof = false | ) |
Extracts the next record from the file.
Returns true if there is another record, or false if the end of file has been reached.
Definition at line 114 of file fltRecordReader.cxx.
References eof().
Referenced by get_record_length(), FltHeader::read_flt(), FltRecord::write(), and FltRecordWriter::write_record().
bool FltRecordReader::eof | ( | ) | const |
Returns true if end-of-file has been reached without error.
Definition at line 220 of file fltRecordReader.cxx.
References error().
Referenced by advance(), FltHeader::read_flt(), and FltRecord::write().
bool FltRecordReader::error | ( | ) | const |
Returns true if some error has been encountered while reading (for instance, a truncated file).
Definition at line 231 of file fltRecordReader.cxx.
References DatagramIterator::get_be_int16(), and DatagramIterator::get_be_uint16().
Referenced by eof(), and FltRecord::write().
const Datagram & FltRecordReader::get_datagram | ( | ) |
Returns the datagram representing the entire record, less the four-byte header.
Definition at line 87 of file fltRecordReader.cxx.
References get_record_length().
Referenced by get_iterator(), and FltUnsupportedRecord::output().
DatagramIterator & FltRecordReader::get_iterator | ( | ) |
Returns an iterator suitable for extracting data from the current record.
Definition at line 75 of file fltRecordReader.cxx.
References get_datagram().
Referenced by FltLocalVertexPool::extract_record(), FltGeometry::get_alt_rgb(), FltTransformRotateAboutEdge::get_angle(), FltTransformRotateAboutPoint::get_angle(), FltTransformRotateScale::get_angle(), FltTransformTranslate::get_from(), get_opcode(), FltHeader::get_trackplane(), FltVectorRecord::get_vector(), FltTransformScale::has_center(), FltBeadID::output(), FltVertexList::output(), FltTransformPut::set(), FltTransformGeneralMatrix::set_matrix(), FltExternalReference::set_ref_filename(), FltBead::set_replicate_count(), FltVertex::set_rgb(), FltInstanceRef::write(), FltRecord::write(), and FltTexture::write_attr_data().
FltOpcode FltRecordReader::get_opcode | ( | ) | const |
Returns the opcode associated with the current record.
Definition at line 63 of file fltRecordReader.cxx.
References get_iterator().
Referenced by FltLocalVertexPool::extract_record(), FltTransformRotateAboutEdge::get_angle(), FltTransformRotateAboutPoint::get_angle(), FltTransformRotateScale::get_angle(), FltTransformTranslate::get_from(), FltHeader::get_trackplane(), FltVectorRecord::get_vector(), FltTransformScale::has_center(), FltUnsupportedRecord::output(), FltBeadID::output(), FltVertexList::output(), FltTransformPut::set(), FltTransformGeneralMatrix::set_matrix(), FltExternalReference::set_ref_filename(), FltBead::set_replicate_count(), FltVertex::set_rgb(), FltInstanceRef::write(), FltRecord::write(), and FltTexture::write_attr_data().
int FltRecordReader::get_record_length | ( | ) | const |
Returns the entire length of the record, including the four-byte header.
Definition at line 102 of file fltRecordReader.cxx.
References advance().
Referenced by get_datagram(), and FltHeader::get_trackplane().