00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: PMPackageManager_update.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 Purpose: 00019 00020 /-*/ 00021 #ifndef PMPackageManager_update_h 00022 #define PMPackageManager_update_h 00023 00024 #include <iosfwd> 00025 #include <set> 00026 00027 #include <y2pm/PMSelectablePtr.h> 00028 00030 // 00031 // CLASS NAME : PMUpdateOpts 00035 class PMUpdateOpts { 00036 00037 public: 00038 00040 // OPTIONS 00042 00046 bool delete_unmaintained; 00047 00048 public: 00049 00050 PMUpdateOpts() { 00051 delete_unmaintained = true; 00052 } 00053 00054 ~PMUpdateOpts() {} 00055 }; 00056 00058 00060 // 00061 // CLASS NAME : PMUpdateStats 00065 class PMUpdateStats : public PMUpdateOpts { 00066 00067 friend std::ostream & operator<<( std::ostream & str, const PMUpdateStats & obj ); 00068 00069 public: 00070 00072 // STATISTICS 00074 00078 unsigned pre_todel; 00082 unsigned pre_nocand; 00086 unsigned pre_avcand; 00087 00088 00092 unsigned chk_installed_total; 00093 00097 unsigned chk_already_todel; 00098 00102 unsigned chk_is_taboo; 00103 00107 unsigned chk_already_toins; 00111 unsigned chk_to_update; 00118 unsigned chk_to_downgrade; 00122 unsigned chk_to_keep_downgrade; 00126 unsigned chk_to_keep_installed; 00127 00133 unsigned chk_keep_foreign; 00139 unsigned chk_dropped; 00145 unsigned chk_replaced; 00151 unsigned chk_add_split; 00159 unsigned chk_replaced_guessed; 00160 00161 public: 00162 00164 // RESULTLISTS 00166 00170 //std::set<PMSelectablePtr> foreign_and_drop_set; 00171 00172 public: 00173 00174 PMUpdateStats() { 00175 // initial status 00176 pre_todel = 0; 00177 pre_nocand = 0; 00178 pre_avcand = 0; 00179 // update checks 00180 chk_installed_total = 0; 00181 chk_already_todel = 0; 00182 chk_is_taboo = 0; 00183 // packages with candidate 00184 chk_already_toins = 0; 00185 chk_to_update = 0; 00186 chk_to_downgrade = 0; 00187 chk_to_keep_downgrade = 0; 00188 chk_to_keep_installed = 0; 00189 // packages without candidate 00190 chk_keep_foreign = 0; 00191 chk_dropped = 0; 00192 chk_replaced = 0; 00193 chk_replaced_guessed = 0; 00194 chk_add_split = 0; 00195 } 00196 ~PMUpdateStats() {} 00197 00201 unsigned totalToInstall() const 00202 { 00203 return chk_already_toins 00204 + chk_to_update + chk_to_downgrade 00205 + chk_replaced + chk_replaced_guessed + chk_add_split; 00206 } 00207 00212 unsigned totalToDelete() const 00213 { 00214 unsigned ret = chk_already_todel; 00215 if ( delete_unmaintained ) 00216 ret += chk_dropped; 00217 return ret; 00218 } 00219 00223 unsigned totalToKeep() const 00224 { 00225 unsigned ret = chk_is_taboo + chk_to_keep_downgrade + chk_to_keep_installed + chk_keep_foreign; 00226 if ( !delete_unmaintained ) 00227 ret += chk_dropped; 00228 return ret; 00229 } 00230 }; 00231 00233 00234 #endif // PMPackageManager_update_h