Panda3D
Loading...
Searching...
No Matches
bamFile.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file bamFile.h
10 * @author drose
11 * @date 2000-07-02
12 */
13
14#ifndef BAMFILE_H
15#define BAMFILE_H
16
17#include "pandabase.h"
18#include "datagramInputFile.h"
19#include "datagramOutputFile.h"
20#include "pandaNode.h"
21#include "pointerTo.h"
22#include "bamEnums.h"
23
24class BamReader;
25class BamWriter;
26class TypedWritable;
27class Filename;
28
29/**
30 * The principle public interface to reading and writing Bam disk files. See
31 * also BamReader and BamWriter, the more general implementation of this
32 * class.
33 *
34 * Bam files are most often used to store scene graphs or subgraphs, and by
35 * convention they are given filenames ending in the extension ".bam" when
36 * they are used for this purpose. However, a Bam file may store any
37 * arbitrary list of TypedWritable objects; in this more general usage, they
38 * are given filenames ending in ".boo" to differentiate them from the more
39 * common scene graph files.
40 */
41class EXPCL_PANDA_PGRAPH BamFile : public BamEnums {
42PUBLISHED:
43 BamFile();
44 ~BamFile();
45
46 bool open_read(const Filename &bam_filename, bool report_errors = true);
47 bool open_read(std::istream &in, const std::string &bam_filename = "stream",
48 bool report_errors = true);
49
50 TypedWritable *read_object();
51
52 bool is_eof() const;
53 bool resolve();
54
55 PT(PandaNode) read_node(bool report_errors = true);
56
57 bool open_write(const Filename &bam_filename, bool report_errors = true);
58 bool open_write(std::ostream &out, const std::string &bam_filename = "stream",
59 bool report_errors = true);
60 bool write_object(const TypedWritable *object);
61
62 void close();
63 INLINE bool is_valid_read() const;
64 INLINE bool is_valid_write() const;
65
66 int get_file_major_ver();
67 int get_file_minor_ver();
68 BamEndian get_file_endian() const;
69 bool get_file_stdfloat_double() const;
70
71 int get_current_major_ver();
72 int get_current_minor_ver();
73
74 BamReader *get_reader();
75 BamWriter *get_writer();
76
77public:
78 EXTENSION(PyObject *get_file_version() const);
79
80PUBLISHED:
81 MAKE_PROPERTY(file_version, get_file_version);
82 MAKE_PROPERTY(file_endian, get_file_endian);
83 MAKE_PROPERTY(file_stdfloat_double, get_file_stdfloat_double);
84
85 MAKE_PROPERTY(reader, get_reader);
86 MAKE_PROPERTY(writer, get_writer);
87
88private:
89 bool continue_open_read(const std::string &bam_filename, bool report_errors);
90 bool continue_open_write(const std::string &bam_filename, bool report_errors);
91
92 std::string _bam_filename;
95 BamReader *_reader;
96 BamWriter *_writer;
97};
98
99#include "bamFile.I"
100
101#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class exists just to provide scoping for the enums shared by BamReader and BamWriter.
Definition bamEnums.h:23
BamEndian
This defines an enumerated type used to represent the endianness of certain numeric values stored in ...
Definition bamEnums.h:32
The principle public interface to reading and writing Bam disk files.
Definition bamFile.h:41
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition bamWriter.h:63
This class can be used to read a binary file that consists of an arbitrary header followed by a numbe...
This class can be used to write a binary file that consists of an arbitrary header followed by a numb...
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.