00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* QueueItemBranch.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_QUEUEITEMBRANCH_H 00023 #define ZYPP_SOLVER_DETAIL_QUEUEITEMBRANCH_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 00033 namespace zypp 00034 { 00035 00036 namespace solver 00037 { 00038 00039 namespace detail 00040 { 00041 00043 // 00044 // CLASS NAME : QueueItemBranch 00045 00046 class QueueItemBranch : public QueueItem { 00047 00048 00049 private: 00050 std::string _label; 00051 QueueItemList _possible_qitems; 00052 00053 public: 00054 00055 QueueItemBranch (const ResPool & pool); 00056 virtual ~QueueItemBranch(); 00057 00058 // ---------------------------------- I/O 00059 00060 virtual std::ostream & dumpOn( std::ostream & str ) const; 00061 00062 friend std::ostream& operator<<(std::ostream & str, const QueueItemBranch & obj) 00063 { return obj.dumpOn (str); } 00064 00065 // ---------------------------------- accessors 00066 00067 QueueItemList possibleQItems (void) const { return _possible_qitems; } 00068 00069 const std::string & label (void) const { return _label; } 00070 void setLabel (const std::string & label) { _label = label; } 00071 00072 bool isEmpty (void) const { return _possible_qitems.empty(); } 00073 00074 // ---------------------------------- methods 00075 00076 virtual bool process (ResolverContext_Ptr context, QueueItemList & qil); 00077 virtual QueueItem_Ptr copy (void) const; 00078 virtual int cmp (QueueItem_constPtr item) const; 00079 virtual bool isRedundant (ResolverContext_Ptr context) const { return false; } 00080 virtual bool isSatisfied (ResolverContext_Ptr context) const { return false; } 00081 00082 void addItem (QueueItem_Ptr subitem); 00083 bool contains (QueueItem_Ptr possible_subbranch); 00084 }; 00085 00087 };// namespace detail 00090 };// namespace solver 00093 };// namespace zypp 00095 #endif // ZYPP_SOLVER_DETAIL_QUEUEITEMBRANCH_H