ResPoolManager.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_RESPOOLMANAGER_H
00013 #define ZYPP_RESPOOLMANAGER_H
00014 
00015 #include <iosfwd>
00016 
00017 #include "zypp/ResPool.h"
00018 #include "zypp/ResPoolProxy.h"
00019 #include "zypp/ResStore.h"
00020 
00022 namespace zypp
00023 { 
00024 
00026   //
00027   //    CLASS NAME : ResPoolManager
00028   //
00030   class ResPoolManager
00031   {
00032     friend std::ostream & operator<<( std::ostream & str, const ResPoolManager & obj );
00033 
00034   public:
00036     typedef pool::PoolTraits::Item           Item;
00037     typedef pool::PoolTraits::size_type      size_type;
00038     typedef pool::PoolTraits::iterator       iterator;
00039     typedef pool::PoolTraits::const_iterator const_iterator;
00040 
00041   public:
00043     ResPoolManager();
00045     ~ResPoolManager();
00046 
00047     ResPool accessor() const
00048     { return ResPool( _pimpl.getPtr() ); }
00049 
00052     ResPoolProxy proxy() const;
00053 
00054   public:
00056     void insert( ResObject::constPtr ptr_r, bool installed = false )
00057     { inserter(installed)( ptr_r ); }
00058 
00059     void insert( const ResStore & store_r, bool installed = false )
00060     { insert( store_r.begin(), store_r.end(), installed ); }
00061 
00063     template <class _InputIterator>
00064       void insert( _InputIterator first_r, _InputIterator last_r, bool installed = false )
00065       { std::for_each( first_r, last_r, inserter(installed) ); }
00066 
00068     void erase( ResObject::constPtr ptr_r )
00069     { deleter()( ptr_r ); }
00070 
00077     void clear();
00078 
00079   private:
00081     typedef pool::PoolTraits::ItemContainerT  ContainerT;
00082     typedef pool::PoolTraits::Impl        Impl;
00083     typedef pool::PoolTraits::Inserter    Inserter;
00084     typedef pool::PoolTraits::Deleter     Deleter;
00085 
00086   private:
00088     RW_pointer<pool::PoolTraits::Impl> _pimpl;
00090     Inserter inserter( bool installed )
00091     { return Inserter( *_pimpl, installed ); }
00093     Deleter deleter()
00094     { return Deleter( *_pimpl ); }
00095   };
00097 
00099   std::ostream & operator<<( std::ostream & str, const ResPoolManager & obj );
00100 
00102 } // namespace zypp
00104 #endif // ZYPP_RESPOOLMANAGER_H

Generated on Tue Sep 25 19:23:06 2007 for libzypp by  doxygen 1.5.3