libzypp: zypp/solver/detail/SolverQueueItemUpdate.cc Source File

libzypp 17.38.11

SolverQueueItemUpdate.cc
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2/* SolverQueueItem.cc
3 *
4 * Copyright (C) 2008 SUSE Linux Products GmbH
5 *
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.
9 *
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.
14 *
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
18 * 02111-1307, USA.
19 */
20extern "C"
21{
22#include <solv/solver.h>
23}
24
25#define ZYPP_USE_RESOLVER_INTERNALS
26
27#include <zypp-core/base/Logger.h>
28#include <zypp/solver/detail/SolverQueueItemUpdate.h>
29
30using std::endl;
31
33namespace zypp
34{
36 namespace solver
37 {
39 namespace detail
40 {
41
42
43 IMPL_PTR_TYPE(SolverQueueItemUpdate);
44
45//---------------------------------------------------------------------------
46
47std::ostream &
48SolverQueueItemUpdate::dumpOn( std::ostream & os ) const
49{
50 os << "[" << (_soft?"Soft":"") << "Update: " <<
51 _item << "]";
52
53 return os;
54}
55
56//---------------------------------------------------------------------------
57
58SolverQueueItemUpdate::SolverQueueItemUpdate (const ResPool & pool,
59 const PoolItem & item, bool soft)
60 : SolverQueueItem (QUEUE_ITEM_TYPE_UPDATE, pool)
61 , _item (item)
62 , _soft (soft)
63{
64}
65
66
67SolverQueueItemUpdate::~SolverQueueItemUpdate()
68{
69}
70
71//---------------------------------------------------------------------------
72
73 bool SolverQueueItemUpdate::addRule (sat::detail::CQueue & q)
74{
75 ::Id id = _item.satSolvable().id();
76 if (id == ID_NULL) {
77 ERR << "Update explicit: " << _item << " not found" << endl;
78 return false;
79 }
80 MIL << "Update explicit " << _item << " with the SAT-Pool ID: " << id << endl;
81 queue_push( &(q), SOLVER_UPDATE | SOLVER_SOLVABLE );
82 queue_push( &(q), id );
83 return true;
84}
85
86SolverQueueItem_Ptr
87SolverQueueItemUpdate::copy (void) const
88{
89 SolverQueueItemUpdate_Ptr new_update = new SolverQueueItemUpdate (pool(), _item);
90 new_update->SolverQueueItem::copy(this);
91
92 new_update->_soft = _soft;
93 return new_update;
94}
95
96int
97SolverQueueItemUpdate::cmp (SolverQueueItem_constPtr item) const
98{
99 int cmp = this->compare (item);
100 if (cmp != 0)
101 return cmp;
102 SolverQueueItemUpdate_constPtr update = dynamic_pointer_cast<const SolverQueueItemUpdate>(item);
103 return compareByNVRA (_item, update->_item);
104}
105
106
107//---------------------------------------------------------------------------
108
109
111 };// namespace detail
114 };// namespace solver
117};// namespace zypp
Logger.h
MIL
#define MIL
Definition Logger.h:103
ERR
#define ERR
Definition Logger.h:105
SolverQueueItemUpdate.h
SolverQueueItem
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
zypp::ResPool
Global ResObject pool.
Definition ResPool.h:62
zypp::solver::detail::SolverQueueItemUpdate
Definition SolverQueueItemUpdate.h:44
zypp::solver::detail::SolverQueueItemUpdate::copy
virtual SolverQueueItem_Ptr copy(void) const
Definition SolverQueueItemUpdate.cc:87
zypp::solver::detail::SolverQueueItemUpdate::_soft
bool _soft
Definition SolverQueueItemUpdate.h:49
zypp::solver::detail::SolverQueueItemUpdate::dumpOn
virtual std::ostream & dumpOn(std::ostream &str) const
Definition SolverQueueItemUpdate.cc:48
zypp::solver::detail::SolverQueueItemUpdate::SolverQueueItemUpdate
SolverQueueItemUpdate(const ResPool &pool, const PoolItem &item, bool soft=false)
Definition SolverQueueItemUpdate.cc:58
zypp::solver::detail::SolverQueueItemUpdate::~SolverQueueItemUpdate
virtual ~SolverQueueItemUpdate()
Definition SolverQueueItemUpdate.cc:67
zypp::solver::detail::SolverQueueItemUpdate::_item
PoolItem _item
Definition SolverQueueItemUpdate.h:48
zypp::solver::detail::SolverQueueItemUpdate::cmp
virtual int cmp(SolverQueueItem_constPtr item) const
Definition SolverQueueItemUpdate.cc:97
zypp::solver::detail::SolverQueueItemUpdate::addRule
virtual bool addRule(sat::detail::CQueue &q)
Definition SolverQueueItemUpdate.cc:73
zypp::pool
Definition ByIdent.h:24
zypp::sat::detail::CQueue
::s_Queue CQueue
Wrapped libsolv C data type exposed as backdoor.
Definition PoolDefines.h:35
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::compareByNVRA
int compareByNVRA(const Resolvable::constPtr &lhs, const Resolvable::constPtr &rhs)
relates: Resolvable Compare Resolvable::constPtr according to kind, name, edition and arch.
Definition Resolvable.h:162
IMPL_PTR_TYPE
#define IMPL_PTR_TYPE(NAME)
Definition ReferenceCounted.h:137