00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef FLTRECORDREADER_H
00016 #define FLTRECORDREADER_H
00017
00018 #include "pandatoolbase.h"
00019
00020 #include "fltOpcode.h"
00021 #include "fltError.h"
00022
00023 #include "datagram.h"
00024 #include "datagramIterator.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class FltRecordReader {
00035 public:
00036 FltRecordReader(istream &in);
00037 ~FltRecordReader();
00038
00039 FltOpcode get_opcode() const;
00040 DatagramIterator &get_iterator();
00041 const Datagram &get_datagram();
00042 int get_record_length() const;
00043
00044 FltError advance(bool ok_eof = false);
00045
00046 bool eof() const;
00047 bool error() const;
00048
00049 private:
00050 void read_next_header();
00051
00052 istream &_in;
00053 Datagram _datagram;
00054 FltOpcode _opcode;
00055 int _record_length;
00056 DatagramIterator *_iterator;
00057
00058 FltError _next_error;
00059 FltOpcode _next_opcode;
00060 int _next_record_length;
00061
00062 enum State {
00063 S_begin,
00064 S_normal,
00065 S_eof,
00066 S_error
00067 };
00068 State _state;
00069 };
00070
00071 #endif
00072
00073