Panda3D
 All Classes Functions Variables Enumerations
fltRecordWriter.h
00001 // Filename: fltRecordWriter.h
00002 // Created by:  drose (24Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef FLTRECORDWRITER_H
00016 #define FLTRECORDWRITER_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "fltOpcode.h"
00021 #include "fltError.h"
00022 
00023 #include "datagram.h"
00024 #include "pset.h"
00025 
00026 class FltHeader;
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //       Class : FltRecordWriter
00030 // Description : This class writes a sequence of FltRecords to an
00031 //               ostream, handling opcode and size counts properly.
00032 ////////////////////////////////////////////////////////////////////
00033 class FltRecordWriter {
00034 public:
00035   FltRecordWriter(ostream &out);
00036   ~FltRecordWriter();
00037 
00038   void set_opcode(FltOpcode opcode);
00039   const Datagram &get_datagram() const;
00040   void set_datagram(const Datagram &datagram);
00041   Datagram &update_datagram();
00042 
00043   FltError advance();
00044 
00045   FltError write_record(FltOpcode opcode,
00046                         const Datagram &datagram = Datagram());
00047 
00048   FltError write_instance_def(FltHeader *header, int instance_index);
00049 
00050 private:
00051   ostream &_out;
00052   Datagram _datagram;
00053   FltOpcode _opcode;
00054 
00055   typedef pset<int> Instances;
00056   Instances _instances_written;
00057 };
00058 
00059 #endif
00060 
00061 
 All Classes Functions Variables Enumerations