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 
00021 namespace zypp
00022 { 
00023 
00025   //
00026   //    CLASS NAME : ResPoolManager
00027   //
00029   class ResPoolManager
00030   {
00031     friend std::ostream & operator<<( std::ostream & str, const ResPoolManager & obj );
00032 
00033   public:
00035     typedef pool::PoolTraits::Item           Item;
00036     typedef pool::PoolTraits::size_type      size_type;
00037     typedef pool::PoolTraits::iterator       iterator;
00038     typedef pool::PoolTraits::const_iterator const_iterator;
00039 
00040   public:
00042     ResPoolManager();
00044     ~ResPoolManager();
00045 
00046     ResPool accessor() const
00047     { return ResPool( _pimpl.getPtr() ); }
00048 
00051     ResPoolProxy proxy() const;
00052 
00053   public:
00055     void insert( ResObject::constPtr ptr_r, bool installed = false )
00056     { inserter(installed)( ptr_r ); }
00057 
00059     template <class _InputIterator>
00060       void insert( _InputIterator first_r, _InputIterator last_r, bool installed = false )
00061       { std::for_each( first_r, last_r, inserter(installed) ); }
00062 
00064     void erase( ResObject::constPtr ptr_r )
00065     { deleter()( ptr_r ); }
00066 
00073     void clear();
00074 
00075   private:
00077     typedef pool::PoolTraits::ItemContainerT  ContainerT;
00078     typedef pool::PoolTraits::Impl        Impl;
00079     typedef pool::PoolTraits::Inserter    Inserter;
00080     typedef pool::PoolTraits::Deleter     Deleter;
00081 
00082   private:
00084     RW_pointer<pool::PoolTraits::Impl> _pimpl;
00086     Inserter inserter( bool installed )
00087     { return Inserter( *_pimpl, installed ); }
00089     Deleter deleter()
00090     { return Deleter( *_pimpl ); }
00091   };
00093 
00095   std::ostream & operator<<( std::ostream & str, const ResPoolManager & obj );
00096 
00098 } // namespace zypp
00100 #endif // ZYPP_RESPOOLMANAGER_H

Generated on Thu Jul 6 00:07:22 2006 for zypp by  doxygen 1.4.6