00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef BAMFILE_H
00016 #define BAMFILE_H
00017
00018 #include "pandabase.h"
00019 #include "datagramInputFile.h"
00020 #include "datagramOutputFile.h"
00021 #include "pandaNode.h"
00022 #include "pointerTo.h"
00023 #include "bamEnums.h"
00024
00025 class BamReader;
00026 class BamWriter;
00027 class TypedWritable;
00028 class Filename;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 class EXPCL_PANDA_PGRAPH BamFile : public BamEnums {
00046 PUBLISHED:
00047 BamFile();
00048 ~BamFile();
00049
00050 bool open_read(const Filename &bam_filename, bool report_errors = true);
00051 bool open_read(istream &in, const string &bam_filename = "stream",
00052 bool report_errors = true);
00053
00054 TypedWritable *read_object();
00055
00056 bool is_eof() const;
00057 bool resolve();
00058
00059 PT(PandaNode) read_node(bool report_errors = true);
00060
00061 bool open_write(const Filename &bam_filename, bool report_errors = true);
00062 bool open_write(ostream &out, const string &bam_filename = "stream",
00063 bool report_errors = true);
00064 bool write_object(const TypedWritable *object);
00065
00066 void close();
00067 INLINE bool is_valid_read() const;
00068 INLINE bool is_valid_write() const;
00069
00070 int get_file_major_ver();
00071 int get_file_minor_ver();
00072 BamEndian get_file_endian() const;
00073 bool get_file_stdfloat_double() const;
00074
00075 int get_current_major_ver();
00076 int get_current_minor_ver();
00077
00078 BamReader *get_reader();
00079 BamWriter *get_writer();
00080
00081 private:
00082 bool continue_open_read(const string &bam_filename, bool report_errors);
00083 bool continue_open_write(const string &bam_filename, bool report_errors);
00084
00085 string _bam_filename;
00086 DatagramInputFile _din;
00087 DatagramOutputFile _dout;
00088 BamReader *_reader;
00089 BamWriter *_writer;
00090 };
00091
00092 #include "bamFile.I"
00093
00094 #endif