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 );
69 queue_push( &(q), SOLVER_INSTALL_SOLVABLE_NAME );
70 queue_push( &(q), id);
72 queue_push( &(q), SOLVER_WEAK );
73 queue_push( &(q), id);
75 MIL << "Install " << _name << (_soft ? "(soft)" : "")
76 << " with SAT-Pooly: " << id << endl;
81 SolverQueueItemInstall::copy (void) const
83 SolverQueueItemInstall_Ptr new_install = new SolverQueueItemInstall (pool(), _name);
84 new_install->SolverQueueItem::copy(this);
86 new_install->_soft = _soft;
91 SolverQueueItemInstall::cmp (SolverQueueItem_constPtr item) const
93 int cmp = this->compare (item);
96 SolverQueueItemInstall_constPtr ins = dynamic_pointer_cast<const SolverQueueItemInstall>(item);
97 if (_name != ins->_name) {
98 return _name.compare(ins->_name);
100 if (_soft == ins->_soft) {
112 //---------------------------------------------------------------------------
115 ///////////////////////////////////////////////////////////////////
116 };// namespace detail
117 /////////////////////////////////////////////////////////////////////
118 /////////////////////////////////////////////////////////////////////
119 };// namespace solver
120 ///////////////////////////////////////////////////////////////////////
121 ///////////////////////////////////////////////////////////////////////
123 /////////////////////////////////////////////////////////////////////////