libzypp  10.5.0
Pool.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_SAT_POOL_H
00013 #define ZYPP_SAT_POOL_H
00014 
00015 #include <iosfwd>
00016 
00017 #include "zypp/Pathname.h"
00018 
00019 #include "zypp/sat/detail/PoolMember.h"
00020 #include "zypp/Repository.h"
00021 #include "zypp/sat/WhatProvides.h"
00022 
00024 namespace zypp
00025 { 
00026 
00027   class SerialNumber;
00028   class RepoInfo;
00029 
00031   namespace sat
00032   { 
00033 
00035     //
00036     //  CLASS NAME : Pool
00037     //
00042     class Pool : protected detail::PoolMember
00043     {
00044       public:
00045         typedef detail::SolvableIterator SolvableIterator;
00046         typedef zypp::detail::RepositoryIterator     RepositoryIterator;
00047         typedef detail::size_type        size_type;
00048 
00049       public:
00051         static Pool instance()
00052         { return Pool(); }
00053 
00055         Pool( const detail::PoolMember & )
00056         {}
00057 
00058       public:
00060         size_type capacity() const;
00061 
00063         const SerialNumber & serial() const;
00064 
00066         void prepare() const;
00067 
00069         void prepareForSolving() const;
00070 
00071       public:
00073         bool reposEmpty() const;
00074 
00076         size_type reposSize() const;
00077 
00079         RepositoryIterator reposBegin() const;
00080 
00082         RepositoryIterator reposEnd() const;
00083 
00088         Repository reposInsert( const std::string & alias_r );
00089 
00093         Repository reposFind( const std::string & alias_r ) const;
00094 
00098         void reposErase( const std::string & alias_r )
00099         { reposFind( alias_r ).eraseFromPool(); }
00100 
00101       public:
00103         static const std::string & systemRepoAlias();
00104 
00106         Repository findSystemRepo() const;
00107 
00109         Repository systemRepo();
00110 
00111       public:
00117         Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
00119         Repository addRepoSolv( const Pathname & file_r );
00123         Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
00124 
00125       public:
00132         Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
00134         Repository addRepoHelix( const Pathname & file_r );
00138         Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
00139 
00140       public:
00142         bool solvablesEmpty() const;
00143 
00145         size_type solvablesSize() const;
00146 
00148         SolvableIterator solvablesBegin() const;
00149 
00151         SolvableIterator solvablesEnd() const;
00152 
00153       public:
00156         template<class _Filter>
00157         filter_iterator<_Filter,SolvableIterator> filterBegin( const _Filter & filter_r ) const
00158         { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
00159 
00160         template<class _Filter>
00161         filter_iterator<_Filter,SolvableIterator> filterEnd( const _Filter & filter_r ) const
00162         { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
00164 
00165      public:
00167         WhatProvides whatProvides( Capability cap_r ) const
00168         { return WhatProvides( cap_r ); }
00169 
00170       public:
00176         void setTextLocale( const Locale & locale_r );
00177 
00182         void setRequestedLocales( const LocaleSet & locales_r );
00183 
00187         bool addRequestedLocale( const Locale & locale_r );
00188 
00192         bool eraseRequestedLocale( const Locale & locale_r );
00193 
00197         const LocaleSet & getRequestedLocales() const;
00198 
00200         bool isRequestedLocale( const Locale & locale_r ) const;
00201 
00206         const LocaleSet & getAvailableLocales() const;
00207 
00209         bool isAvailableLocale( const Locale & locale_r ) const;
00211 
00212       public:
00218         typedef IdStringSet::const_iterator MultiversionIterator;
00219 
00220         bool multiversionEmpty() const;
00221         size_t multiversionSize() const;
00222         MultiversionIterator multiversionBegin() const;
00223         MultiversionIterator multiversionEnd() const;
00224 
00225         bool isMultiversion( IdString ident_r ) const;
00227 
00228       public:
00233         typedef IdStringSet::const_iterator OnSystemByUserIterator;
00234 
00235         bool onSystemByUserEmpty() const;
00236         size_t onSystemByUserSize() const;
00237         OnSystemByUserIterator onSystemByUserBegin() const;
00238         OnSystemByUserIterator onSystemByUserEnd() const;
00239 
00240         bool isOnSystemByUser( IdString ident_r ) const;
00242 
00243       public:
00245         ::_Pool * get() const;
00246       private:
00248         Pool() {}
00249     };
00251 
00253     std::ostream & operator<<( std::ostream & str, const Pool & obj );
00254 
00256     inline bool operator==( const Pool & lhs, const Pool & rhs )
00257     { return lhs.get() == rhs.get(); }
00258 
00260     inline bool operator!=( const Pool & lhs, const Pool & rhs )
00261     { return lhs.get() != rhs.get(); }
00262 
00264   } // namespace sat
00267 } // namespace zypp
00269 #endif // ZYPP_SAT_POOL_H