00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* ResolverQueue.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_RESOLVERQUEUE_H 00023 #define ZYPP_SOLVER_DETAIL_RESOLVERQUEUE_H 00024 00025 #include <iosfwd> 00026 #include <list> 00027 #include <map> 00028 #include <string> 00029 00030 #include "zypp/base/ReferenceCounted.h" 00031 #include "zypp/base/NonCopyable.h" 00032 #include "zypp/base/PtrTypes.h" 00033 00034 #include "zypp/solver/detail/Types.h" 00035 #include "zypp/solver/detail/QueueItem.h" 00036 00037 #include "zypp/Capability.h" 00038 00040 namespace zypp 00041 { 00042 00043 namespace solver 00044 { 00045 00046 namespace detail 00047 { 00048 00049 typedef std::list <ResolverQueue_Ptr> ResolverQueueList; 00050 00052 // 00053 // CLASS NAME : ResolverQueue 00054 00055 class ResolverQueue : public base::ReferenceCounted, private base::NonCopyable { 00056 00057 private: 00058 00059 ResolverContext_Ptr _context; 00060 QueueItemList _qitems; 00061 00062 ResolverQueue_Ptr copy_queue_except_for_branch (QueueItem_Ptr branch_qitem, QueueItem_Ptr subqitem) const; 00063 00064 public: 00065 ResolverQueue (const ResPool & pool, const Arch & arch, ResolverContext_Ptr context = NULL); 00066 virtual ~ResolverQueue(); 00067 00068 // ---------------------------------- I/O 00069 00070 friend std::ostream& operator<<(std::ostream&, const ResolverQueue & context); 00071 00072 // ---------------------------------- accessors 00073 00074 ResolverContext_Ptr context (void) const { return _context; } 00075 QueueItemList qitems(void) const { return _qitems; } 00076 00077 // ---------------------------------- methods 00078 00079 void addPoolItemToInstall (PoolItem_Ref poolItem); 00080 void addPoolItemToEstablish (PoolItem_Ref poolItem); 00081 void addPoolItemToRemove (PoolItem_Ref poolItem, bool remove_only_mode); 00082 void addPoolItemToVerify (PoolItem_Ref poolItem); 00083 void addExtraCapability (const Capability & cap); 00084 void addExtraConflict (const Capability & cap); 00085 void addItem (QueueItem_Ptr qtem); 00086 00087 bool isEmpty () const { return _qitems.empty(); } 00088 bool isInvalid (); 00089 bool containsOnlyBranches (); 00090 00091 bool processOnce (); 00092 void process (); 00093 00094 void splitFirstBranch (ResolverQueueList & new_queues, ResolverQueueList & deferred_queues); 00095 00096 void spew (); 00097 00098 }; 00100 };// namespace detail 00103 };// namespace solver 00106 };// namespace zypp 00108 00109 #endif // ZYPP_SOLVER_DETAIL_RESOLVERQUEUE_H 00110