1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
4 * Copyright (C) 2008 SUSE Linux Products GmbH
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 #include "zypp/base/Logger.h"
22 #include "zypp/solver/detail/SolverQueueItemInstallOneOf.h"
24 /////////////////////////////////////////////////////////////////////////
26 { ///////////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////////
29 { /////////////////////////////////////////////////////////////////////
30 /////////////////////////////////////////////////////////////////////
32 { ///////////////////////////////////////////////////////////////////
36 IMPL_PTR_TYPE(SolverQueueItemInstallOneOf);
38 //---------------------------------------------------------------------------
41 SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const
43 os << "[" << "InstallOneOf: ";
44 for (PoolItemList::const_iterator iter = _oneOfList.begin();
45 iter != _oneOfList.end();
53 //---------------------------------------------------------------------------
55 SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList)
56 : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL_ONE_OF, pool)
57 , _oneOfList (itemList)
62 SolverQueueItemInstallOneOf::~SolverQueueItemInstallOneOf()
66 //---------------------------------------------------------------------------
68 bool SolverQueueItemInstallOneOf::addRule (Queue & q, Pool *SATPool)
71 MIL << "Install one of: " << endl;
72 queue_push( &(q), SOLVER_INSTALL_SOLVABLE_ONE_OF );
73 for (PoolItemList::const_iterator iter = _oneOfList.begin(); iter != _oneOfList.end(); iter++) {
74 Id id = (*iter)->satSolvable().id();
76 ERR << *iter << " not found" << endl;
79 MIL << " candidate:" << *iter << " with the SAT-Pool ID: " << id << endl;
80 queue_push( &(q), id );
83 queue_push( &(q), 0 ); // finish candidate
89 SolverQueueItemInstallOneOf::copy (void) const
91 SolverQueueItemInstallOneOf_Ptr new_installOneOf = new SolverQueueItemInstallOneOf (pool(), _oneOfList);
92 new_installOneOf->SolverQueueItem::copy(this);
94 return new_installOneOf;
98 SolverQueueItemInstallOneOf::cmp (SolverQueueItem_constPtr item) const
100 int cmp = this->compare (item);
103 SolverQueueItemInstallOneOf_constPtr install = dynamic_pointer_cast<const SolverQueueItemInstallOneOf>(item);
105 return (_oneOfList == install->_oneOfList) ? 0 : -1; // more evaluation would be not useful
109 //---------------------------------------------------------------------------
112 ///////////////////////////////////////////////////////////////////
113 };// namespace detail
114 /////////////////////////////////////////////////////////////////////
115 /////////////////////////////////////////////////////////////////////
116 };// namespace solver
117 ///////////////////////////////////////////////////////////////////////
118 ///////////////////////////////////////////////////////////////////////
120 /////////////////////////////////////////////////////////////////////////