libzypp: zypp/sat/SolvIterMixin.cc Source File

libzypp 17.38.14

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
15#include <zypp/sat/SolvIterMixin.h>
16#include <zypp/sat/Solvable.h>
17#include <zypp/ResPoolProxy.h>
18#include <zypp/pool/PoolTraits.h>
19
20using std::endl;
21
23namespace zypp
24{
26 namespace sat
27 {
28
29 namespace solvitermixin_detail
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
61 Solvable asSolvable::operator()( const PoolItem & pi_r ) const
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
PoolTraits.h
ResPoolProxy.h
SolvIterMixin.h
Solvable.h
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
zypp::ResPoolProxy::lookup
ui::Selectable::Ptr lookup(const pool::ByIdent &ident_r) const
Definition ResPoolProxy.cc:276
zypp::ResPool::instance
static ResPool instance()
Singleton ctor.
Definition ResPool.cc:38
zypp::ResPool::proxy
ResPoolProxy proxy() const
preliminary
Definition ResPool.cc:59
zypp::pool::ByIdent
Main filter selecting PoolItems by name and kind.
Definition ByIdent.h:29
zypp::pool::ByIdent::get
sat::detail::IdType get() const
Definition ByIdent.h:90
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition Solvable.h:54
zypp::sat::Solvable::id
IdType id() const
Expert backdoor.
Definition Solvable.h:464
zypp::sat::Solvable::Solvable
Solvable()
Default ctor creates noSolvable.
Definition Solvable.h:67
zypp::sat::detail::SolvableIdType
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition PoolDefines.h:63
zypp::sat::detail::IdType
int IdType
Generic Id type.
Definition PoolDefines.h:42
zypp::sat::solvitermixin_detail
Definition SolvIterMixin.cc:30
zypp::sat
Libsolv interface
zypp::ui
Definition SolvIterMixin.cc:77
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::sat::SolvableType::satSolvable
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition SolvableType.h:57
zypp::sat::asSolvable::operator()
Solvable operator()(const Solvable &solv_r) const
Definition Solvable.h:601
zypp::sat::solvitermixin_detail::UnifyByIdent2::_umap
shared_ptr< Umap > _umap
Definition SolvIterMixin.h:52
zypp::sat::solvitermixin_detail::UnifyByIdent2::operator()
bool operator()(const Solvable &solv_r) const
Definition SolvIterMixin.cc:31
zypp::ui::asSelectable::operator()
Selectable_Ptr operator()(const sat::Solvable &solv_r) const
Definition SolvIterMixin.cc:79