Panda3D

patchfile.I

00001 // Filename: patchfile.I
00002 // Created by:  darren, mike (09Jan97)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 //#include "config_downloader.h"
00016 
00017 ////////////////////////////////////////////////////////////////////
00018 //     Function: Patchfile::get_progress
00019 //       Access: Published
00020 //  Description: Returns a value in the range 0..1, representing the
00021 //               amount of progress through the patchfile, during a
00022 //               session.
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE PN_stdfloat Patchfile::
00025 get_progress() const {
00026   if (!_initiated) {
00027     express_cat.warning()
00028       << "Patchfile::get_progress() - Patch has not been initiated" << endl;
00029     return 0.0f;
00030   }
00031   nassertr(_total_bytes_to_process > 0, 0.0f);
00032   return ((PN_stdfloat)_total_bytes_processed / (PN_stdfloat)_total_bytes_to_process);
00033 }
00034 
00035 ////////////////////////////////////////////////////////////////////
00036 //     Function: Patchfile::set_allow_multifile
00037 //       Access: Published
00038 //  Description: If this flag is set true, the Patchfile will make a
00039 //               special case for patching Panda Multifiles, if
00040 //               detected, and attempt to patch them on a
00041 //               subfile-by-subfile basis.  If this flag is false, the
00042 //               Patchfile will always patch the file on a full-file
00043 //               basis.
00044 //
00045 //               This has effect only when building patches; it is not
00046 //               used for applying patches.
00047 ////////////////////////////////////////////////////////////////////
00048 INLINE void Patchfile::
00049 set_allow_multifile(bool allow_multifile) {
00050   _allow_multifile = allow_multifile;
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: Patchfile::get_allow_multifile
00055 //       Access: Published
00056 //  Description: See set_allow_multifile().
00057 ////////////////////////////////////////////////////////////////////
00058 INLINE bool Patchfile::
00059 get_allow_multifile() {
00060   return _allow_multifile;
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: Patchfile::set_footprint_length
00065 //       Access: Published
00066 //  Description:
00067 ////////////////////////////////////////////////////////////////////
00068 INLINE void Patchfile::
00069 set_footprint_length(int length) {
00070   nassertv(length > 0);
00071   _footprint_length = length;
00072 }
00073 
00074 ////////////////////////////////////////////////////////////////////
00075 //     Function: Patchfile::get_footprint_length
00076 //       Access: Published
00077 //  Description:
00078 ////////////////////////////////////////////////////////////////////
00079 INLINE int Patchfile::
00080 get_footprint_length() {
00081   return _footprint_length;
00082 }
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //     Function: Patchfile::reset_footprint_length
00086 //       Access: Published
00087 //  Description:
00088 ////////////////////////////////////////////////////////////////////
00089 INLINE void Patchfile::
00090 reset_footprint_length() {
00091   _footprint_length = _DEFAULT_FOOTPRINT_LENGTH;
00092 }
00093 
00094 ////////////////////////////////////////////////////////////////////
00095 //     Function: Patchfile::has_source_hash
00096 //       Access: Published
00097 //  Description: Returns true if the MD5 hash for the source file is
00098 //               known.  (Some early versions of the patch file did
00099 //               not store this information.)
00100 ////////////////////////////////////////////////////////////////////
00101 INLINE bool Patchfile::
00102 has_source_hash() const {
00103   return (_version_number >= 1);
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: Patchfile::get_source_hash
00108 //       Access: Published
00109 //  Description: Returns the MD5 hash for the source file.
00110 ////////////////////////////////////////////////////////////////////
00111 INLINE const HashVal &Patchfile::
00112 get_source_hash() const {
00113   nassertr(has_source_hash(), _MD5_ofSource);
00114   return _MD5_ofSource;
00115 }
00116 
00117 ////////////////////////////////////////////////////////////////////
00118 //     Function: Patchfile::get_result_hash
00119 //       Access: Published
00120 //  Description: Returns the MD5 hash for the file after the patch has
00121 //               been applied.
00122 ////////////////////////////////////////////////////////////////////
00123 INLINE const HashVal &Patchfile::
00124 get_result_hash() const {
00125   return _MD5_ofResult;
00126 }
 All Classes Functions Variables Enumerations