libzypp 17.38.3
SolvIterMixin.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12//#include <iostream>
13//#include <zypp-core/base/Logger.h>
14
16#include <zypp/sat/Solvable.h>
17#include <zypp/ResPoolProxy.h>
19
20using std::endl;
21
23namespace zypp
24{
26 namespace sat
27 {
28
30 {
31 bool UnifyByIdent2::operator()( const Solvable & solv_r ) const
32 {
33 bool ret = false;
34 if ( solv_r ) {
35 // Need to use pool::ByIdent because packages and srcpackages have the same ident() id!
36 sat::detail::IdType myident = pool::ByIdent( solv_r ).get();
37 sat::detail::SolvableIdType myid = solv_r.id();
38 auto inmapiter = _umap->insert( std::make_pair( myident, myid ) ).first;
39 if ( inmapiter->second == myid )
40 ret = true; // solv_r represents it's ident
41 }
42 return ret;
43 }
44
45#if LEGACY(1735)
46 // It's flawed because the representing solvable (the 1st one that stored it's
47 // ident id) can not be visited twice. Furthermore a UnifyByIdent instance is
48 // shared among iterator copies. So no iterator is able to visit an item
49 // that has been visited by itself or by another iterator copy before.
50 bool UnifyByIdent::operator()( const Solvable & solv_r ) const
51 {
52 // Need to use pool::ByIdent because packages and srcpackages have the same id.
53 return( solv_r && _uset->insert( pool::ByIdent( solv_r ).get() ).second );
54 }
55#endif
56 }
57
59 // asSolvable
62 {
63 return pi_r.satSolvable();
64 }
65
66 Solvable asSolvable::operator()( const ResObject_constPtr & res_r ) const
67 {
68 return res_r ? res_r->satSolvable() : Solvable();
69 }
70
72 } // namespace sat
74
76 namespace ui
77 {
78
79 Selectable_Ptr asSelectable::operator()( const sat::Solvable & sov_r ) const
80 {
81 return ResPool::instance().proxy().lookup( sov_r );
82 }
83
85 } // namespace ui
86
88} // namespace zypp
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
ui::Selectable::Ptr lookup(const pool::ByIdent &ident_r) const
static ResPool instance()
Singleton ctor.
Definition ResPool.cc:38
ResPoolProxy proxy() const
preliminary
Definition ResPool.cc:59
Main filter selecting PoolItems by name and kind.
Definition ByIdent.h:29
sat::detail::IdType get() const
Definition ByIdent.h:90
A Solvable object within the sat Pool.
Definition Solvable.h:54
IdType id() const
Expert backdoor.
Definition Solvable.h:464
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition PoolMember.h:125
int IdType
Generic Id type.
Definition PoolMember.h:104
Libsolv interface
Easy-to use interface to the ZYPP dependency resolver.
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Solvable operator()(const Solvable &solv_r) const
Definition Solvable.h:601
bool operator()(const Solvable &solv_r) const
Selectable_Ptr operator()(const sat::Solvable &solv_r) const