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

panda/src/pgraph/bamFile.h

Go to the documentation of this file.
00001 // Filename: bamFile.h
00002 // Created by:  drose (02Jul00)
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 BAMFILE_H
00020 #define BAMFILE_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "datagramInputFile.h"
00025 #include "datagramOutputFile.h"
00026 
00027 class BamReader;
00028 class BamWriter;
00029 class TypedWritable;
00030 class Filename;
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //       Class : BamFile
00034 // Description : The principle public interface to reading and writing
00035 //               Bam disk files.  See also BamReader and BamWriter,
00036 //               the more general implementation of this class.
00037 //
00038 //               Bam files are most often used to store scene graphs
00039 //               or subgraphs, and by convention they are given
00040 //               filenames ending in the extension ".bam" when they
00041 //               are used for this purpose.  However, a Bam file may
00042 //               store any arbitrary list of TypedWritable objects;
00043 //               in this more general usage, they are given filenames
00044 //               ending in ".boo" to differentiate them from the more
00045 //               common scene graph files.
00046 ////////////////////////////////////////////////////////////////////
00047 class EXPCL_PANDA BamFile {
00048 PUBLISHED:
00049   BamFile();
00050   ~BamFile();
00051 
00052   bool open_read(const Filename &filename, bool report_errors = true);
00053   TypedWritable *read_object();
00054   bool is_eof() const;
00055   bool resolve();
00056 
00057   bool open_write(const Filename &filename, bool report_errors = true);
00058   bool write_object(const TypedWritable *object);
00059 
00060   void close();
00061   INLINE bool is_valid_read() const;
00062   INLINE bool is_valid_write() const;
00063 
00064   int get_file_major_ver();
00065   int get_file_minor_ver();
00066 
00067   int get_current_major_ver();
00068   int get_current_minor_ver();
00069 
00070 private:
00071   DatagramInputFile _din;
00072   DatagramOutputFile _dout;
00073   BamReader *_reader;
00074   BamWriter *_writer;
00075 };
00076 
00077 #include "bamFile.I"
00078 
00079 #endif

Generated on Fri May 2 00:41:05 2003 for Panda by doxygen1.3