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 
00063     bool silent_downgrades;
00064 
00070     bool keep_installed_patches;
00071 
00072   public:
00073 
00074     UpgradeOptions()
00075     : delete_unmaintained   ( false )
00076     , silent_downgrades     ( false )
00077     , keep_installed_patches( true )
00078     {}
00079 
00080     ~UpgradeOptions() {}
00081 };
00082 
00084 
00086 //
00087 //      CLASS NAME : UpgradeStatistics
00091 class UpgradeStatistics : public UpgradeOptions {
00092 
00093     virtual std::ostream & dumpOn( std::ostream & str ) const;
00094     friend std::ostream & operator<<( std::ostream & str, const UpgradeStatistics & obj )
00095     { return obj.dumpOn (str); }
00096 
00097   public:
00098 
00100     // STATISTICS
00102 
00106     unsigned pre_todel;
00110     unsigned pre_nocand;
00114     unsigned pre_avcand;
00115 
00116 
00120     unsigned chk_installed_total;
00121 
00125     unsigned chk_already_todel;
00126 
00130     unsigned chk_is_taboo;
00131 
00135     unsigned chk_already_toins;
00136 
00140     unsigned chk_to_update;
00141 
00148     unsigned chk_to_downgrade;
00149 
00153     unsigned chk_to_keep_downgrade;
00154 
00158     unsigned chk_to_keep_installed;
00159 
00165     unsigned chk_keep_foreign;
00166 
00172     unsigned chk_dropped;
00173 
00179     unsigned chk_replaced;
00180 
00186     unsigned chk_add_split;
00187 
00195     unsigned chk_replaced_guessed;
00196 
00197   public:
00198 
00199     UpgradeStatistics() {
00200       // initial status
00201       pre_todel                 = 0;
00202       pre_nocand                = 0;
00203       pre_avcand                = 0;
00204       // update checks
00205       chk_installed_total       = 0;
00206       chk_already_todel         = 0;
00207       chk_is_taboo              = 0;
00208       // packages with candidate
00209       chk_already_toins         = 0;
00210       chk_to_update             = 0;
00211       chk_to_downgrade          = 0;
00212       chk_to_keep_downgrade     = 0;
00213       chk_to_keep_installed     = 0;
00214       // packages without candidate
00215       chk_keep_foreign          = 0;
00216       chk_dropped               = 0;
00217       chk_replaced              = 0;
00218       chk_replaced_guessed      = 0;
00219       chk_add_split             = 0;
00220     }
00221     virtual ~UpgradeStatistics();
00222 
00226     unsigned totalToInstall() const
00227     {
00228       return chk_already_toins
00229         + chk_to_update + chk_to_downgrade
00230         + chk_replaced + chk_replaced_guessed + chk_add_split;
00231     }
00232 
00237     unsigned totalToDelete() const
00238     {
00239       unsigned ret = chk_already_todel;
00240       if ( delete_unmaintained )
00241         ret += chk_dropped;
00242       return ret;
00243     }
00244 
00248     unsigned totalToKeep() const
00249     {
00250       unsigned ret = chk_is_taboo + chk_to_keep_downgrade + chk_to_keep_installed + chk_keep_foreign;
00251       if ( !delete_unmaintained )
00252         ret += chk_dropped;
00253       return ret;
00254     }
00255 };
00256 
00259 };// namespace zypp
00261 
00262 
00263 #endif // ZYPP_UPGRADESTATISTICS_H

Generated on Tue Sep 25 19:23:11 2007 for libzypp by  doxygen 1.5.3