1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/pool/PoolImpl.cc
13 //#include "zypp/base/Logger.h"
15 #include "zypp/pool/PoolImpl.h"
16 #include "zypp/CapSet.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////
29 // METHOD NAME : PoolImpl::PoolImpl
35 ///////////////////////////////////////////////////////////////////
37 // METHOD NAME : PoolImpl::~PoolImpl
43 /******************************************************************
45 ** FUNCTION NAME : operator<<
46 ** FUNCTION TYPE : std::ostream &
48 std::ostream & operator<<( std::ostream & str, const PoolImpl & obj )
50 return str << "PoolImpl " << obj.size();
53 void PoolImplInserter::operator()( ResObject::constPtr ptr_r, bool installed )
55 PoolImpl::Item item ( ptr_r, ResStatus (installed) );
56 _poolImpl.store().insert( item );
57 _poolImpl.namestore().insert( PoolImpl::NameContainerT::value_type (item->name(), item ) );
58 CapSet provides = item->dep( Dep::PROVIDES );
59 for (CapSet::iterator ic = provides.begin(); ic != provides.end(); ++ic) {
60 _poolImpl.providesstore().insert( PoolImpl::IndexContainerT::value_type (ic->index(), std::make_pair( *ic, item ) ) );
62 CapSet requires = item->dep( Dep::REQUIRES );
63 for (CapSet::iterator ic = requires.begin(); ic != requires.end(); ++ic) {
64 _poolImpl.requiresstore().insert( PoolImpl::IndexContainerT::value_type (ic->index(), std::make_pair( *ic, item ) ) );
66 CapSet conflicts = item->dep( Dep::CONFLICTS );
67 for (CapSet::iterator ic = conflicts.begin(); ic != conflicts.end(); ++ic) {
68 _poolImpl.conflictsstore().insert( PoolImpl::IndexContainerT::value_type (ic->index(), std::make_pair( *ic, item ) ) );
72 void PoolImplDeleter::operator()( ResObject::constPtr ptr_r )
74 PoolImpl::Item item( ptr_r );
75 _poolImpl.store().erase( item );
76 for (PoolImpl::nameiterator nit = _poolImpl.namestore().lower_bound (item->name());
77 nit != _poolImpl.namestore().upper_bound (item->name()); ++nit)
79 if (nit->second == item)
80 _poolImpl.namestore().erase( nit );
82 CapSet provides = ptr_r->dep( Dep::PROVIDES );
83 for (CapSet::iterator ic = provides.begin(); ic != provides.end(); ++ic) {
84 for (PoolImpl::indexiterator iit = _poolImpl.providesstore().lower_bound (ic->index());
85 iit != _poolImpl.providesstore().upper_bound (ic->index()); ++iit)
87 if (iit->second.second == item)
88 _poolImpl.providesstore().erase( iit );
91 CapSet requires = ptr_r->dep( Dep::REQUIRES );
92 for (CapSet::iterator ic = requires.begin(); ic != requires.end(); ++ic) {
93 for (PoolImpl::indexiterator iit = _poolImpl.requiresstore().lower_bound (ic->index());
94 iit != _poolImpl.requiresstore().upper_bound (ic->index()); ++iit)
96 if (iit->second.second == item)
97 _poolImpl.requiresstore().erase( iit );
100 CapSet conflicts = ptr_r->dep( Dep::CONFLICTS );
101 for (CapSet::iterator ic = conflicts.begin(); ic != conflicts.end(); ++ic) {
102 for (PoolImpl::indexiterator iit = _poolImpl.conflictsstore().lower_bound (ic->index());
103 iit != _poolImpl.conflictsstore().upper_bound (ic->index()); ++iit)
105 if (iit->second.second == item)
106 _poolImpl.conflictsstore().erase( iit );
111 /////////////////////////////////////////////////////////////////
113 ///////////////////////////////////////////////////////////////////
114 /////////////////////////////////////////////////////////////////
116 ///////////////////////////////////////////////////////////////////