#include <fltRecordReader.h>
Public Member Functions | |
FltRecordReader (istream &in) | |
~FltRecordReader () | |
FltOpcode | get_opcode () const |
Returns the opcode associated with the current record. | |
DatagramIterator & | get_iterator () |
Returns an iterator suitable for extracting data from the current record. | |
const Datagram & | get_datagram () |
Returns the datagram representing the entire record, less the four-byte header. | |
int | get_record_length () const |
Returns the entire length of the record, including the four-byte header. | |
FltError | advance (bool ok_eof=false) |
Extracts the next record from the file. | |
bool | eof () const |
Returns true if end-of-file has been reached without error. | |
bool | error () const |
Returns true if some error has been encountered while reading (for instance, a truncated file). | |
Private Types | |
enum | State { S_begin, S_normal, S_eof, S_error } |
Private Member Functions | |
void | read_next_header () |
Reads the four-byte header for the next record, which contains the next opcode and record length. | |
Private Attributes | |
istream & | _in |
Datagram | _datagram |
FltOpcode | _opcode |
int | _record_length |
DatagramIterator * | _iterator |
FltError | _next_error |
FltOpcode | _next_opcode |
int | _next_record_length |
State | _state |
It remembers where it is in the file and what the current record is.
Definition at line 48 of file fltRecordReader.h.
|
Definition at line 76 of file fltRecordReader.h. |
|
Definition at line 37 of file fltRecordReader.cxx. |
|
Definition at line 60 of file fltRecordReader.cxx. References _opcode, _state, FltOpcode, FO_none, nassertr, and S_normal. |
|
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 146 of file fltRecordReader.cxx. References _next_opcode, _next_record_length, _opcode, and _record_length. |
|
Returns true if end-of-file has been reached without error.
Definition at line 256 of file fltRecordReader.cxx. References _next_error, and FE_end_of_file. |
|
Returns true if some error has been encountered while reading (for instance, a truncated file).
Definition at line 271 of file fltRecordReader.cxx. References _next_error, and FE_invalid_record. |
|
Returns the datagram representing the entire record, less the four-byte header.
Definition at line 110 of file fltRecordReader.cxx. References _iterator, _state, FE_end_of_file, FE_read_error, flt_error_abort, FltError, NULL, S_eof, and S_error. |
|
Returns an iterator suitable for extracting data from the current record.
Definition at line 94 of file fltRecordReader.cxx. References _iterator. |
|
Returns the opcode associated with the current record.
Definition at line 78 of file fltRecordReader.cxx. |
|
Returns the entire length of the record, including the four-byte header.
Definition at line 129 of file fltRecordReader.cxx. |
|
Reads the four-byte header for the next record, which contains the next opcode and record length. We need read the next header in advance so we can check to see if it happens to be a continuation record. If it is, we will need to concatenate the records together before returning. Definition at line 296 of file fltRecordReader.cxx. |
|
Definition at line 67 of file fltRecordReader.h. |
|
Definition at line 66 of file fltRecordReader.h. |
|
Definition at line 70 of file fltRecordReader.h. Referenced by get_datagram(), get_iterator(), get_opcode(), and get_record_length(). |
|
Definition at line 72 of file fltRecordReader.h. |
|
Definition at line 73 of file fltRecordReader.h. Referenced by advance(). |
|
Definition at line 74 of file fltRecordReader.h. Referenced by advance(). |
|
Definition at line 68 of file fltRecordReader.h. Referenced by advance(), and ~FltRecordReader(). |
|
Definition at line 69 of file fltRecordReader.h. Referenced by advance(). |
|
Definition at line 82 of file fltRecordReader.h. Referenced by get_datagram(), get_opcode(), and ~FltRecordReader(). |