1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ResPoolManager.h
12 #ifndef ZYPP_RESPOOLMANAGER_H
13 #define ZYPP_RESPOOLMANAGER_H
17 #include "zypp/ResPool.h"
18 #include "zypp/ResPoolProxy.h"
19 #include "zypp/ResStore.h"
21 ///////////////////////////////////////////////////////////////////
23 { /////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////
27 // CLASS NAME : ResPoolManager
29 /** Manage a ResObject pool. */
32 friend std::ostream & operator<<( std::ostream & str, const ResPoolManager & obj );
36 typedef pool::PoolTraits::Item Item;
37 typedef pool::PoolTraits::size_type size_type;
38 typedef pool::PoolTraits::iterator iterator;
39 typedef pool::PoolTraits::const_iterator const_iterator;
47 ResPool accessor() const
48 { return ResPool( _pimpl.getPtr() ); }
50 /** \todo Speedup by using a data mamaber invaidated only
51 * whenever the pool content changes */
52 ResPoolProxy proxy() const;
56 void insert( ResObject::constPtr ptr_r, bool installed = false )
57 { inserter(installed)( ptr_r ); }
59 void insert( const ResStore & store_r, bool installed = false )
60 { insert( store_r.begin(), store_r.end(), installed ); }
63 template <class _InputIterator>
64 void insert( _InputIterator first_r, _InputIterator last_r, bool installed = false )
65 { std::for_each( first_r, last_r, inserter(installed) ); }
68 void erase( ResObject::constPtr ptr_r )
69 { deleter()( ptr_r ); }
72 void erase( iterator first_r, iterator last_r )
73 { std::for_each( first_r, last_r, deleter() ); }
81 typedef pool::PoolTraits::ItemContainerT ContainerT;
82 typedef pool::PoolTraits::Impl Impl;
83 typedef pool::PoolTraits::Inserter Inserter;
84 typedef pool::PoolTraits::Deleter Deleter;
87 /** Pointer to implementation */
88 RW_pointer<pool::PoolTraits::Impl> _pimpl;
90 Inserter inserter( bool installed )
91 { return Inserter( *_pimpl, installed ); }
94 { return Deleter( *_pimpl ); }
96 ///////////////////////////////////////////////////////////////////
98 /** \relates ResPoolManager Stream output */
99 std::ostream & operator<<( std::ostream & str, const ResPoolManager & obj );
101 /////////////////////////////////////////////////////////////////
103 ///////////////////////////////////////////////////////////////////
104 #endif // ZYPP_RESPOOLMANAGER_H