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 <satsolver/solver.h>
25 #include "zypp/base/Logger.h"
26 #include "zypp/IdString.h"
27 #include "zypp/solver/detail/SolverQueueItemDelete.h"
29 /////////////////////////////////////////////////////////////////////////
31 { ///////////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////////
34 { /////////////////////////////////////////////////////////////////////
35 /////////////////////////////////////////////////////////////////////
37 { ///////////////////////////////////////////////////////////////////
41 IMPL_PTR_TYPE(SolverQueueItemDelete);
43 //---------------------------------------------------------------------------
46 SolverQueueItemDelete::dumpOn( std::ostream & os ) const
48 os << "[" << (_soft?"Soft":"") << "Delete: "
54 //---------------------------------------------------------------------------
56 SolverQueueItemDelete::SolverQueueItemDelete (const ResPool & pool, std::string name, bool soft)
57 : SolverQueueItem (QUEUE_ITEM_TYPE_DELETE, pool)
64 SolverQueueItemDelete::~SolverQueueItemDelete()
68 //---------------------------------------------------------------------------
70 bool SolverQueueItemDelete::addRule (_Queue & q)
72 ::Id id = IdString(_name).id();
74 queue_push( &(q), SOLVER_ERASE_SOLVABLE_NAME | SOLVER_WEAK);
76 queue_push( &(q), SOLVER_ERASE_SOLVABLE_NAME );
78 queue_push( &(q), id);
80 MIL << "Delete " << _name << (_soft ? "(soft)" : "")
81 << " with SAT-Pool: " << id << endl;
86 SolverQueueItemDelete::copy (void) const
88 SolverQueueItemDelete_Ptr new_delete = new SolverQueueItemDelete (pool(), _name);
89 new_delete->SolverQueueItem::copy(this);
91 new_delete->_soft = _soft;
96 SolverQueueItemDelete::cmp (SolverQueueItem_constPtr item) const
98 int cmp = this->compare (item);
101 SolverQueueItemDelete_constPtr del = dynamic_pointer_cast<const SolverQueueItemDelete>(item);
102 if (_name != del->_name) {
103 return _name.compare(del->_name);
108 //---------------------------------------------------------------------------
111 ///////////////////////////////////////////////////////////////////
112 };// namespace detail
113 /////////////////////////////////////////////////////////////////////
114 /////////////////////////////////////////////////////////////////////
115 };// namespace solver
116 ///////////////////////////////////////////////////////////////////////
117 ///////////////////////////////////////////////////////////////////////
119 /////////////////////////////////////////////////////////////////////////