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
22 #include <solv/solver.h>
25 #define ZYPP_USE_RESOLVER_INTERNALS
27 #include "zypp/base/Logger.h"
28 #include "zypp/solver/detail/SolverQueueItemUpdate.h"
30 /////////////////////////////////////////////////////////////////////////
32 { ///////////////////////////////////////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////
35 { /////////////////////////////////////////////////////////////////////
36 /////////////////////////////////////////////////////////////////////
38 { ///////////////////////////////////////////////////////////////////
42 IMPL_PTR_TYPE(SolverQueueItemUpdate);
44 //---------------------------------------------------------------------------
47 SolverQueueItemUpdate::dumpOn( std::ostream & os ) const
49 os << "[" << (_soft?"Soft":"") << "Update: " <<
55 //---------------------------------------------------------------------------
57 SolverQueueItemUpdate::SolverQueueItemUpdate (const ResPool & pool,
58 const PoolItem & item, bool soft)
59 : SolverQueueItem (QUEUE_ITEM_TYPE_UPDATE, pool)
66 SolverQueueItemUpdate::~SolverQueueItemUpdate()
70 //---------------------------------------------------------------------------
72 bool SolverQueueItemUpdate::addRule (_Queue & q)
74 ::Id id = _item.satSolvable().id();
76 ERR << "Update explicit: " << _item << " not found" << endl;
79 MIL << "Update explicit " << _item << " with the SAT-Pool ID: " << id << endl;
80 queue_push( &(q), SOLVER_UPDATE | SOLVER_SOLVABLE );
81 queue_push( &(q), id );
86 SolverQueueItemUpdate::copy (void) const
88 SolverQueueItemUpdate_Ptr new_update = new SolverQueueItemUpdate (pool(), _item);
89 new_update->SolverQueueItem::copy(this);
91 new_update->_soft = _soft;
96 SolverQueueItemUpdate::cmp (SolverQueueItem_constPtr item) const
98 int cmp = this->compare (item);
101 SolverQueueItemUpdate_constPtr update = dynamic_pointer_cast<const SolverQueueItemUpdate>(item);
102 return compareByNVRA (_item, update->_item);
106 //---------------------------------------------------------------------------
109 ///////////////////////////////////////////////////////////////////
110 };// namespace detail
111 /////////////////////////////////////////////////////////////////////
112 /////////////////////////////////////////////////////////////////////
113 };// namespace solver
114 ///////////////////////////////////////////////////////////////////////
115 ///////////////////////////////////////////////////////////////////////
117 /////////////////////////////////////////////////////////////////////////