forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatagramInputFile.h
More file actions
65 lines (54 loc) · 1.63 KB
/
datagramInputFile.h
File metadata and controls
65 lines (54 loc) · 1.63 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
/**
* 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."
*
* @file datagramInputFile.h
* @author drose
* @date 2000-10-30
*/
#ifndef DATAGRAMINPUTFILE_H
#define DATAGRAMINPUTFILE_H
#include "pandabase.h"
#include "datagramGenerator.h"
#include "filename.h"
#include "fileReference.h"
#include "virtualFile.h"
/**
* This class can be used to read a binary file that consists of an arbitrary
* header followed by a number of datagrams.
*/
class EXPCL_PANDA_PUTIL DatagramInputFile : public DatagramGenerator {
PUBLISHED:
INLINE DatagramInputFile();
INLINE ~DatagramInputFile();
bool open(const FileReference *file);
INLINE bool open(const Filename &filename);
bool open(std::istream &in, const Filename &filename = Filename());
INLINE std::istream &get_stream();
void close();
bool read_header(std::string &header, size_t num_bytes);
virtual bool get_datagram(Datagram &data);
virtual bool save_datagram(SubfileInfo &info);
virtual bool is_eof();
virtual bool is_error();
virtual const Filename &get_filename();
virtual time_t get_timestamp() const;
virtual const FileReference *get_file();
virtual VirtualFile *get_vfile();
virtual std::streampos get_file_pos();
private:
bool _read_first_datagram;
bool _error;
CPT(FileReference) _file;
PT(VirtualFile) _vfile;
std::istream *_in;
bool _owns_in;
Filename _filename;
time_t _timestamp;
};
#include "datagramInputFile.I"
#endif