Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/flt/fltRecordReader.h

Go to the documentation of this file.
00001 // Filename: fltRecordReader.h
00002 // Created by:  drose (24Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef FLTRECORDREADER_H
00020 #define FLTRECORDREADER_H
00021 
00022 #include <pandatoolbase.h>
00023 
00024 #include "fltOpcode.h"
00025 #include "fltError.h"
00026 
00027 #include <datagram.h>
00028 #include <datagramIterator.h>
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //       Class : FltRecordReader
00032 // Description : This class turns an istream into a sequence of
00033 //               FltRecords by reading a sequence of Datagrams and
00034 //               extracting the opcode from each one.  It remembers
00035 //               where it is in the file and what the current record
00036 //               is.
00037 ////////////////////////////////////////////////////////////////////
00038 class FltRecordReader {
00039 public:
00040   FltRecordReader(istream &in);
00041   ~FltRecordReader();
00042 
00043   FltOpcode get_opcode() const;
00044   DatagramIterator &get_iterator();
00045   const Datagram &get_datagram();
00046   int get_record_length() const;
00047 
00048   FltError advance(bool ok_eof = false);
00049 
00050   bool eof() const;
00051   bool error() const;
00052 
00053 private:
00054   void read_next_header();
00055 
00056   istream &_in;
00057   Datagram _datagram;
00058   FltOpcode _opcode;
00059   int _record_length;
00060   DatagramIterator *_iterator;
00061 
00062   FltError _next_error;
00063   FltOpcode _next_opcode;
00064   int _next_record_length;
00065 
00066   enum State {
00067     S_begin,
00068     S_normal,
00069     S_eof,
00070     S_error
00071   };
00072   State _state;
00073 };
00074 
00075 #endif
00076 
00077 

Generated on Fri May 2 03:19:33 2003 for Panda-Tool by doxygen1.3