UpgradeStatistics.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* ResolverUpgrade.h
00003  *
00004  * Copyright (C) 2005 SUSE Linux Products GmbH
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License,
00008  * version 2, as published by the Free Software Foundation.
00009  *
00010  * This program is distributed in the hope that it will be useful, but
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018  * 02111-1307, USA.
00019  */
00020 
00021 /*
00022   stolen from PMPackageManager_update.cc
00023   original author Michael Andres <ma@suse.de>
00024   zypp port by Klaus Kaempf <kkaempf@suse.de>
00025 
00026 /-*/
00027 
00028 #ifndef ZYPP_UPGRADESTATISTICS_H
00029 #define ZYPP_UPGRADESTATISTICS_H
00030 
00031 #include <iosfwd>
00032 #include <list>
00033 #include <string>
00034 
00036 namespace zypp
00037 { 
00038 
00040 //
00041 //      CLASS NAME : UpgradeOptions
00045 class UpgradeOptions {
00046 
00047   public:
00048 
00050     // OPTIONS
00052 
00056     bool delete_unmaintained;
00057 
00058   public:
00059 
00060     UpgradeOptions() {
00061       delete_unmaintained = true;
00062     }
00063 
00064     ~UpgradeOptions() {}
00065 };
00066 
00068 
00070 //
00071 //      CLASS NAME : UpgradeStatistics
00075 class UpgradeStatistics : public UpgradeOptions {
00076 
00077     virtual std::ostream & dumpOn( std::ostream & str ) const;
00078     friend std::ostream & operator<<( std::ostream & str, const UpgradeStatistics & obj )
00079     { return obj.dumpOn (str); }
00080 
00081   public:
00082 
00084     // STATISTICS
00086 
00090     unsigned pre_todel;
00094     unsigned pre_nocand;
00098     unsigned pre_avcand;
00099 
00100 
00104     unsigned chk_installed_total;
00105 
00109     unsigned chk_already_todel;
00110 
00114     unsigned chk_is_taboo;
00115 
00119     unsigned chk_already_toins;
00120 
00124     unsigned chk_to_update;
00125 
00132     unsigned chk_to_downgrade;
00133 
00137     unsigned chk_to_keep_downgrade;
00138 
00142     unsigned chk_to_keep_installed;
00143 
00149     unsigned chk_keep_foreign;
00150 
00156     unsigned chk_dropped;
00157 
00163     unsigned chk_replaced;
00164 
00170     unsigned chk_add_split;
00171 
00179     unsigned chk_replaced_guessed;
00180 
00181   public:
00182 
00183     UpgradeStatistics() {
00184       // initial status
00185       pre_todel                 = 0;
00186       pre_nocand                = 0;
00187       pre_avcand                = 0;
00188       // update checks
00189       chk_installed_total       = 0;
00190       chk_already_todel         = 0;
00191       chk_is_taboo              = 0;
00192       // packages with candidate
00193       chk_already_toins         = 0;
00194       chk_to_update             = 0;
00195       chk_to_downgrade          = 0;
00196       chk_to_keep_downgrade     = 0;
00197       chk_to_keep_installed     = 0;
00198       // packages without candidate
00199       chk_keep_foreign          = 0;
00200       chk_dropped               = 0;
00201       chk_replaced              = 0;
00202       chk_replaced_guessed      = 0;
00203       chk_add_split             = 0;
00204     }
00205     virtual ~UpgradeStatistics();
00206 
00210     unsigned totalToInstall() const
00211     {
00212       return chk_already_toins
00213         + chk_to_update + chk_to_downgrade
00214         + chk_replaced + chk_replaced_guessed + chk_add_split;
00215     }
00216 
00221     unsigned totalToDelete() const
00222     {
00223       unsigned ret = chk_already_todel;
00224       if ( delete_unmaintained )
00225         ret += chk_dropped;
00226       return ret;
00227     }
00228 
00232     unsigned totalToKeep() const
00233     {
00234       unsigned ret = chk_is_taboo + chk_to_keep_downgrade + chk_to_keep_installed + chk_keep_foreign;
00235       if ( !delete_unmaintained )
00236         ret += chk_dropped;
00237       return ret;
00238     }
00239 };
00240 
00243 };// namespace zypp
00245 
00246 
00247 #endif // ZYPP_UPGRADESTATISTICS_H

Generated on Thu Jul 6 00:07:28 2006 for zypp by  doxygen 1.4.6