forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbamFile.h
More file actions
94 lines (77 loc) · 2.89 KB
/
bamFile.h
File metadata and controls
94 lines (77 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Filename: bamFile.h
// Created by: drose (02Jul00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef BAMFILE_H
#define BAMFILE_H
#include "pandabase.h"
#include "datagramInputFile.h"
#include "datagramOutputFile.h"
#include "pandaNode.h"
#include "pointerTo.h"
#include "bamEnums.h"
class BamReader;
class BamWriter;
class TypedWritable;
class Filename;
////////////////////////////////////////////////////////////////////
// Class : BamFile
// Description : The principle public interface to reading and writing
// Bam disk files. See also BamReader and BamWriter,
// the more general implementation of this class.
//
// Bam files are most often used to store scene graphs
// or subgraphs, and by convention they are given
// filenames ending in the extension ".bam" when they
// are used for this purpose. However, a Bam file may
// store any arbitrary list of TypedWritable objects;
// in this more general usage, they are given filenames
// ending in ".boo" to differentiate them from the more
// common scene graph files.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_PGRAPH BamFile : public BamEnums {
PUBLISHED:
BamFile();
~BamFile();
bool open_read(const Filename &bam_filename, bool report_errors = true);
bool open_read(istream &in, const string &bam_filename = "stream",
bool report_errors = true);
TypedWritable *read_object();
bool is_eof() const;
bool resolve();
PT(PandaNode) read_node(bool report_errors = true);
bool open_write(const Filename &bam_filename, bool report_errors = true);
bool open_write(ostream &out, const string &bam_filename = "stream",
bool report_errors = true);
bool write_object(const TypedWritable *object);
void close();
INLINE bool is_valid_read() const;
INLINE bool is_valid_write() const;
int get_file_major_ver();
int get_file_minor_ver();
BamEndian get_file_endian() const;
bool get_file_stdfloat_double() const;
int get_current_major_ver();
int get_current_minor_ver();
BamReader *get_reader();
BamWriter *get_writer();
private:
bool continue_open_read(const string &bam_filename, bool report_errors);
bool continue_open_write(const string &bam_filename, bool report_errors);
string _bam_filename;
DatagramInputFile _din;
DatagramOutputFile _dout;
BamReader *_reader;
BamWriter *_writer;
};
#include "bamFile.I"
#endif