17 #include "pandabase.h" 20 #include "multifile.h" 22 #include "datagramIterator.h" 25 #include "pointerTo.h" 32 typedef PN_stdfloat Phase;
41 header_length multifile_name phase version size status num_files
42 header_length file_name version hash
43 header_length file_name version hash
44 header_length multifile_name phase version size status num_files
45 header_length file_name version hash
46 header_length file_name version hash
51 A Db is a Vector<MultifileRecord>
52 MultifileRecord is a Vector<FileRecord>
74 Status_incomplete = 0,
76 Status_decompressed = 2,
85 void output(ostream &out)
const;
86 void write(ostream &out)
const;
87 void write_version_map(ostream &out)
const;
90 bool write_client_db(
Filename &file);
91 bool write_server_db(
Filename &file);
93 INLINE
int get_client_num_multifiles()
const;
94 INLINE
int get_server_num_multifiles()
const;
96 INLINE
string get_client_multifile_name(
int index)
const;
97 INLINE
string get_server_multifile_name(
int index)
const;
99 INLINE
int get_client_multifile_size(
string mfname)
const;
100 INLINE
void set_client_multifile_size(
string mfname,
int size);
101 INLINE
int set_client_multifile_delta_size(
string mfname,
int size);
102 INLINE
int get_server_multifile_size(
string mfname)
const;
103 INLINE
void set_server_multifile_size(
string mfname,
int size);
105 INLINE Phase get_client_multifile_phase(
string mfname)
const;
106 INLINE Phase get_server_multifile_phase(
string mfname)
const;
108 INLINE
void set_client_multifile_incomplete(
string mfname);
109 INLINE
void set_client_multifile_complete(
string mfname);
110 INLINE
void set_client_multifile_decompressed(
string mfname);
111 INLINE
void set_client_multifile_extracted(
string mfname);
113 INLINE
int get_server_num_files(
string mfname)
const;
114 INLINE
string get_server_file_name(
string mfname,
int index)
const;
117 bool client_multifile_exists(
string mfname)
const;
118 bool client_multifile_complete(
string mfname)
const;
119 bool client_multifile_decompressed(
string mfname)
const;
120 bool client_multifile_extracted(
string mfname)
const;
123 HashVal get_client_multifile_hash(
string mfname)
const;
124 void set_client_multifile_hash(
string mfname,
HashVal val);
125 HashVal get_server_multifile_hash(
string mfname)
const;
126 void set_server_multifile_hash(
string mfname,
HashVal val);
129 void delete_client_multifile(
string mfname);
130 void add_client_multifile(
string server_mfname);
131 void expand_client_multifile(
string mfname);
134 void create_new_server_db();
135 void server_add_multifile(
string mfname, Phase phase,
int size,
int status);
136 void server_add_file(
string mfname,
string fname);
144 void write(ostream &out)
const;
154 void write(ostream &out)
const;
155 int get_num_files()
const;
156 string get_file_name(
int index)
const;
157 bool file_exists(
string fname)
const;
158 PT(
FileRecord) get_file_record_named(
string fname)
const;
166 FileRecords _file_records;
171 class EXPCL_PANDAEXPRESS
Db {
174 void write(ostream &out)
const;
175 int get_num_multifiles()
const;
176 string get_multifile_name(
int index)
const;
177 bool multifile_exists(
string mfname)
const;
180 int parse_header(
const string &data);
181 int parse_record_header(
const string &data);
187 MultifileRecords _mfile_records;
188 bool write_header(ostream &write_stream);
191 PN_int32 _header_length;
195 Db read_db(
Filename &file,
bool want_server_info);
196 Db read_db(
Ramfile &file,
bool want_server_info);
197 bool write_db(
Filename &file,
Db db,
bool want_server_info);
206 static PN_uint32 _magic_number;
207 static PN_uint32 _bogus_magic_number;
212 void add_version(
const Filename &name,
const HashVal &hash,
int version);
214 bool has_version(
const Filename &name)
const;
215 int get_num_versions(
const Filename &name)
const;
216 void set_num_versions(
const Filename &name,
int num_versions);
224 VersionMap _versions;
227 INLINE ostream &operator << (ostream &out,
const DownloadDb &dldb) {
233 #include "downloadDb.I" A StreamWriter object is used to write sequential binary data directly to an ostream.
A listing of files within multifiles for management of client-side synchronization with a server-prov...
Stores a 128-bit value that represents the hashed contents (typically MD5) of a file or buffer...
The name of a file, such as a texture file or an Egg file.
An in-memory buffer specifically designed for downloading files to memory.
A base class for all things that want to be reference-counted.
A class to read sequential binary data directly from an istream.