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/IdString.h"
29 #include "zypp/IdStringType.h"
30 #include "zypp/solver/detail/SolverQueueItemInstall.h"
32 /////////////////////////////////////////////////////////////////////////
34 { ///////////////////////////////////////////////////////////////////////
35 ///////////////////////////////////////////////////////////////////////
37 { /////////////////////////////////////////////////////////////////////
38 /////////////////////////////////////////////////////////////////////
40 { ///////////////////////////////////////////////////////////////////
44 IMPL_PTR_TYPE(SolverQueueItemInstall);
46 //---------------------------------------------------------------------------
49 SolverQueueItemInstall::dumpOn( std::ostream & os ) const
51 os << "[" << (_soft?"Soft":"") << "Install: "
58 //---------------------------------------------------------------------------
60 SolverQueueItemInstall::SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft)
61 : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL, pool)
68 SolverQueueItemInstall::~SolverQueueItemInstall()
72 //---------------------------------------------------------------------------
74 bool SolverQueueItemInstall::addRule (sat::detail::CQueue & q)
76 ::Id id = IdString(_name).id();
78 queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME | SOLVER_WEAK );
80 queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE_NAME );
82 queue_push( &(q), id);
84 MIL << "Install " << _name << (_soft ? "(soft)" : "")
85 << " with SAT-PoolID: " << id << endl;
90 SolverQueueItemInstall::copy (void) const
92 SolverQueueItemInstall_Ptr new_install = new SolverQueueItemInstall (pool(), _name);
93 new_install->SolverQueueItem::copy(this);
95 new_install->_soft = _soft;
100 SolverQueueItemInstall::cmp (SolverQueueItem_constPtr item) const
102 int cmp = this->compare (item);
105 SolverQueueItemInstall_constPtr ins = dynamic_pointer_cast<const SolverQueueItemInstall>(item);
106 if (_name != ins->_name) {
107 return _name.compare(ins->_name);
113 //---------------------------------------------------------------------------
116 ///////////////////////////////////////////////////////////////////
117 };// namespace detail
118 /////////////////////////////////////////////////////////////////////
119 /////////////////////////////////////////////////////////////////////
120 };// namespace solver
121 ///////////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////////
124 /////////////////////////////////////////////////////////////////////////