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/SolverQueueItemInstall.h"
24 /////////////////////////////////////////////////////////////////////////
26 { ///////////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////////
29 { /////////////////////////////////////////////////////////////////////
30 /////////////////////////////////////////////////////////////////////
32 { ///////////////////////////////////////////////////////////////////
36 IMPL_PTR_TYPE(SolverQueueItemInstall);
38 //---------------------------------------------------------------------------
41 SolverQueueItemInstall::dumpOn( std::ostream & os ) const
43 os << "[" << (_soft?"Soft":"") << "Install: "
50 //---------------------------------------------------------------------------
52 SolverQueueItemInstall::SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft)
53 : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL, pool)
60 SolverQueueItemInstall::~SolverQueueItemInstall()
64 //---------------------------------------------------------------------------
66 bool SolverQueueItemInstall::addRule (Queue & q, Pool *SATPool)
68 Id id = str2id( SATPool, _name.c_str(), 0 );
70 queue_push( &(q), SOLVER_INSTALL_SOLVABLE_NAME | SOLVER_WEAK );
72 queue_push( &(q), SOLVER_INSTALL_SOLVABLE_NAME );
74 queue_push( &(q), id);
76 MIL << "Install " << _name << (_soft ? "(soft)" : "")
77 << " with SAT-Pooly: " << id << endl;
82 SolverQueueItemInstall::copy (void) const
84 SolverQueueItemInstall_Ptr new_install = new SolverQueueItemInstall (pool(), _name);
85 new_install->SolverQueueItem::copy(this);
87 new_install->_soft = _soft;
92 SolverQueueItemInstall::cmp (SolverQueueItem_constPtr item) const
94 int cmp = this->compare (item);
97 SolverQueueItemInstall_constPtr ins = dynamic_pointer_cast<const SolverQueueItemInstall>(item);
98 if (_name != ins->_name) {
99 return _name.compare(ins->_name);
101 if (_soft == ins->_soft) {
113 //---------------------------------------------------------------------------
116 ///////////////////////////////////////////////////////////////////
117 };// namespace detail
118 /////////////////////////////////////////////////////////////////////
119 /////////////////////////////////////////////////////////////////////
120 };// namespace solver
121 ///////////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////////
124 /////////////////////////////////////////////////////////////////////////