Panda3D
Loading...
Searching...
No Matches
datagramOutputFile.I
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 datagramOutputFile.I
10 * @author drose
11 * @date 2000-10-27
12 */
13
14/**
15 *
16 */
17INLINE DatagramOutputFile::
18DatagramOutputFile() {
19 _error = false;
20 _wrote_first_datagram = false;
21 _out = nullptr;
22 _owns_out = false;
23}
24
25/**
26 *
27 */
28INLINE DatagramOutputFile::
29~DatagramOutputFile() {
30 close();
31}
32
33/**
34 * Opens the indicated filename for writing. Returns true on success, false
35 * on failure.
36 */
38open(const Filename &filename) {
39 return open(new FileReference(filename));
40}
41
42/**
43 * Returns the ostream represented by the output file.
44 */
45INLINE std::ostream &DatagramOutputFile::
46get_stream() {
47 static std::ofstream null_stream;
48 nassertr(_out != nullptr, null_stream);
49 return *_out;
50}
bool open(const FileReference *file)
Opens the indicated filename for writing.
void close()
Closes the file.
get_stream
Returns the ostream represented by the output file.
Keeps a reference-counted pointer to a file on disk.
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44