ResolverInfo.h

Go to the documentation of this file.
00001 #/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* ResolverInfo.h
00003  *
00004  * Copyright (C) 2000-2002 Ximian, Inc.
00005  * Copyright (C) 2005 SUSE Linux Products GmbH
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License,
00009  * version 2, as published by the Free Software Foundation.
00010  *
00011  * This program is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019  * 02111-1307, USA.
00020  */
00021 
00022 #ifndef ZYPP_SOLVER_DETAIL_RESOLVER_INFO_H
00023 #define ZYPP_SOLVER_DETAIL_RESOLVER_INFO_H
00024 
00025 #include "zypp/solver/detail/Types.h"
00026 
00028 namespace zypp
00029 { 
00030 
00031   namespace solver
00032   { 
00033 
00034     namespace detail
00035     { 
00036 
00037 typedef enum {
00038     RESOLVER_INFO_TYPE_INVALID = 0,
00039     RESOLVER_INFO_TYPE_NEEDED_BY,
00040     RESOLVER_INFO_TYPE_CONFLICTS_WITH,
00041     RESOLVER_INFO_TYPE_OBSOLETES,
00042     RESOLVER_INFO_TYPE_DEPENDS_ON,
00043     RESOLVER_INFO_TYPE_CHILD_OF,
00044     RESOLVER_INFO_TYPE_MISSING_REQ,
00045         // from ResolverContext
00046     RESOLVER_INFO_TYPE_INVALID_SOLUTION,                // Marking this resolution attempt as invalid.
00047     RESOLVER_INFO_TYPE_UNINSTALLABLE,                   // Marking p as uninstallable
00048     RESOLVER_INFO_TYPE_REJECT_INSTALL,                  // p is scheduled to be installed, but this is not possible because of dependency problems.
00049     RESOLVER_INFO_TYPE_INSTALL_TO_BE_UNINSTALLED,       // Can't install p since it is already marked as needing to be uninstalled
00050     RESOLVER_INFO_TYPE_INSTALL_UNNEEDED,                // Can't install p since it is does not apply to this system.
00051     RESOLVER_INFO_TYPE_INSTALL_PARALLEL,                // Can't install p, since a resolvable of the same name is already marked as needing to be installed.
00052     RESOLVER_INFO_TYPE_INCOMPLETES,                     // This would invalidate p
00053         // from QueueItemEstablish
00054     RESOLVER_INFO_TYPE_ESTABLISHING,                    // Establishing p
00055         // from QueueItemInstall
00056     RESOLVER_INFO_TYPE_INSTALLING,                      // Installing p
00057     RESOLVER_INFO_TYPE_UPDATING,                        // Updating p
00058     RESOLVER_INFO_TYPE_SKIPPING,                        // Skipping p, already installed
00059         // from QueueItemRequire
00060     RESOLVER_INFO_TYPE_NO_OTHER_PROVIDER,               // There are no alternative installed providers of c [for p]
00061     RESOLVER_INFO_TYPE_NO_PROVIDER,                     // There are no installable providers of c [for p]
00062     RESOLVER_INFO_TYPE_NO_UPGRADE,                      // Upgrade to q to avoid removing p is not possible.
00063     RESOLVER_INFO_TYPE_UNINSTALL_PROVIDER,              // p provides c but is scheduled to be uninstalled
00064     RESOLVER_INFO_TYPE_PARALLEL_PROVIDER,               // p provides c but another version is already installed
00065     RESOLVER_INFO_TYPE_NOT_INSTALLABLE_PROVIDER,        // p provides c but is uninstallable
00066     RESOLVER_INFO_TYPE_LOCKED_PROVIDER,                 // p provides c but is locked
00067     RESOLVER_INFO_TYPE_OTHER_ARCH_PROVIDER,             // p provides c but has other architecture
00068     RESOLVER_INFO_TYPE_CANT_SATISFY,                    // Can't satisfy requirement c
00069         // from QueueItemUninstall
00070     RESOLVER_INFO_TYPE_UNINSTALL_TO_BE_INSTALLED,       // p is to-be-installed, so it won't be unlinked.
00071     RESOLVER_INFO_TYPE_UNINSTALL_INSTALLED,             // p is required by installed, so it won't be unlinked.
00072     RESOLVER_INFO_TYPE_UNINSTALL_LOCKED,                // cant uninstall, its locked
00073         // from QueueItemConflict
00074     RESOLVER_INFO_TYPE_CONFLICT_CANT_INSTALL,           // to-be-installed p conflicts with q due to c
00075     RESOLVER_INFO_TYPE_CONFLICT_UNINSTALLABLE           // uninstalled p is marked uninstallable it conflicts [with q] due to c
00076 } ResolverInfoType;
00077 
00078 #define RESOLVER_INFO_PRIORITY_USER      500
00079 #define RESOLVER_INFO_PRIORITY_VERBOSE   100
00080 #define RESOLVER_INFO_PRIORITY_DEBUGGING   0
00081 
00082 typedef void (*ResolverInfoFn) (ResolverInfo_Ptr info, void *data);
00083 
00084 typedef std::list <ResolverInfo_Ptr> ResolverInfoList;
00085 
00087 //
00088 //      CLASS NAME : ResolverInfo
00089 
00090 class ResolverInfo : public base::ReferenceCounted, private base::NonCopyable {
00091 
00092   private:
00093 
00094     ResolverInfoType _type;
00095 
00096     PoolItem_Ref _affected;
00097 
00098     int _priority;
00099 
00100     bool _error;
00101     bool _important;
00102 
00103   protected:
00104 
00105     ResolverInfo (ResolverInfoType type, PoolItem_Ref affected, int priority);
00106 
00107   public:
00108 
00109     virtual ~ResolverInfo();
00110 
00111     void copy (ResolverInfo_constPtr from);
00112 
00113     // ---------------------------------- I/O
00114 
00115     static std::string toString (PoolItem_Ref item);
00116     static std::string toString (const Capability & capability);
00117 
00118     virtual std::ostream & dumpOn( std::ostream & str ) const;
00119     friend std::ostream& operator<<(std::ostream & str, const ResolverInfo & obj)
00120     { return obj.dumpOn (str); }
00121 
00122     // ---------------------------------- accessors
00123 
00124     ResolverInfoType type (void) const { return _type; }
00125     PoolItem_Ref affected (void) const { return _affected; }
00126     int priority (void) const { return _priority; }
00127 
00128     int error (void) const { return _error; }
00129     void flagAsError (void) { _error = true; }
00130     int important (void) const { return _important || _error; }
00131     void flagAsImportant (void) { _important = true; }
00132 
00133     // ---------------------------------- methods
00134 
00135     virtual std::string message (void) const;
00136     bool merge (ResolverInfo_Ptr to_be_merged);
00137     virtual ResolverInfo_Ptr copy (void) const;
00138 
00139     bool isAbout (PoolItem_Ref item) const;
00140 };
00141 
00143     };// namespace detail
00146   };// namespace solver
00149 };// namespace zypp
00151 #endif // ZYPP_SOLVER_DETAIL_RESOLVER_INFO_H
00152 

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