00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* QueueItemInstall.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_QUEUEITEMINSTALL_H 00023 #define ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H 00024 00025 #include <iosfwd> 00026 #include <list> 00027 #include <string> 00028 00029 #include "zypp/solver/detail/Types.h" 00030 #include "zypp/solver/detail/QueueItem.h" 00031 #include "zypp/CapSet.h" 00032 00034 namespace zypp 00035 { 00036 00037 namespace solver 00038 { 00039 00040 namespace detail 00041 { 00042 00044 // 00045 // CLASS NAME : QueueItemInstall 00046 00047 class QueueItemInstall : public QueueItem { 00048 00049 00050 private: 00051 PoolItem_Ref _item; // the item to-be-installed 00052 bool _soft; // if triggered by a soft requirement (a recommends) 00053 PoolItem_Ref _upgrades; // the item this install upgrades (if any) 00054 CapSet _deps_satisfied_by_this_install; 00055 PoolItemList _needed_by; 00056 int _channel_priority; 00057 int _other_penalty; 00058 00059 bool _explicitly_requested; 00060 00061 public: 00062 00063 QueueItemInstall (const ResPool & pool, PoolItem_Ref item, bool soft = false); 00064 virtual ~QueueItemInstall(); 00065 00066 // ---------------------------------- I/O 00067 00068 virtual std::ostream & dumpOn( std::ostream & str ) const; 00069 00070 friend std::ostream& operator<<(std::ostream & str, const QueueItemInstall & obj) 00071 { return obj.dumpOn (str); } 00072 00073 // ---------------------------------- accessors 00074 00075 PoolItem_Ref item(void) const { return _item; } 00076 00077 bool isSoft (void) const { return _soft; } 00078 00079 PoolItem_Ref upgrades (void) const { return _upgrades; } 00080 void setUpgrades (PoolItem_Ref upgrades) { _upgrades = upgrades; } 00081 00082 int channelPriority (void) const { return _channel_priority; } 00083 void setChannelPriority (int channel_priority) { _channel_priority = channel_priority; } 00084 00085 int otherPenalty (void) { return _other_penalty; } 00086 void setOtherPenalty (int other_penalty) { _other_penalty = other_penalty; } 00087 00088 void setExplicitlyRequested (void) { _explicitly_requested = true; } 00089 00090 // ---------------------------------- methods 00091 00092 virtual bool process (ResolverContext_Ptr context, QueueItemList & qil); 00093 virtual QueueItem_Ptr copy (void) const; 00094 virtual int cmp (QueueItem_constPtr item) const; 00095 00096 virtual bool isRedundant (ResolverContext_Ptr context) const { return false; } 00097 virtual bool isSatisfied (ResolverContext_Ptr context) const; 00098 00099 void addDependency (const Capability & capability); 00100 void addNeededBy (const PoolItem_Ref item); 00101 00102 }; 00103 00105 };// namespace detail 00108 };// namespace solver 00111 };// namespace zypp 00113 00114 #endif // ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H