libzypp  17.14.0
Pool.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_SAT_POOL_H
13 #define ZYPP_SAT_POOL_H
14 
15 #include <iosfwd>
16 
17 #include "zypp/Pathname.h"
18 
20 #include "zypp/Repository.h"
21 #include "zypp/sat/WhatProvides.h"
22 #include "zypp/sat/SolvableSet.h"
23 #include "zypp/sat/Queue.h"
24 
26 namespace zypp
27 {
28 
29  class SerialNumber;
30  class RepoInfo;
31 
33  namespace sat
34  {
35 
36  class SolvableSpec;
37 
39  //
40  // CLASS NAME : Pool
41  //
46  class Pool : protected detail::PoolMember
47  {
48  public:
52 
53  public:
55  static Pool instance()
56  { return Pool(); }
57 
60  {}
61 
62  public:
64  size_type capacity() const;
65 
67  const SerialNumber & serial() const;
68 
70  const SerialNumber & serialIDs() const;
71 
73  void prepare() const;
74 
76  Pathname rootDir() const;
77 
79  void rootDir( const Pathname & root_r );
80 
81  public:
83  bool reposEmpty() const;
84 
86  size_type reposSize() const;
87 
90 
93 
96  { return makeIterable( reposBegin(), reposEnd() ); }
97 
102  Repository reposInsert( const std::string & alias_r );
103 
107  Repository reposFind( const std::string & alias_r ) const;
108 
112  void reposErase( const std::string & alias_r )
113  { reposFind( alias_r ).eraseFromPool(); }
114 
120  { while ( ! reposEmpty() ) reposErase( reposBegin()->alias() ); }
121 
122  public:
124  static const std::string & systemRepoAlias();
125 
127  Repository findSystemRepo() const;
128 
131 
132  public:
138  Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
140  Repository addRepoSolv( const Pathname & file_r );
144  Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
145 
146  public:
153  Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
155  Repository addRepoHelix( const Pathname & file_r );
159  Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
160 
161  public:
163  bool solvablesEmpty() const;
164 
166  size_type solvablesSize() const;
167 
170 
173 
176  { return makeIterable( solvablesBegin(), solvablesEnd() ); }
177 
178  public:
181  template<class TFilter>
182  filter_iterator<TFilter,SolvableIterator> filterBegin( const TFilter & filter_r ) const
183  { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
184 
185  template<class TFilter>
186  filter_iterator<TFilter,SolvableIterator> filterEnd( const TFilter & filter_r ) const
187  { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
189 
190  public:
193  { return WhatProvides( cap_r ); }
194 
195  public:
201  void setTextLocale( const Locale & locale_r );
202 
207  void setRequestedLocales( const LocaleSet & locales_r );
208 
212  bool addRequestedLocale( const Locale & locale_r );
213 
217  bool eraseRequestedLocale( const Locale & locale_r );
218 
222  const LocaleSet & getRequestedLocales() const;
223 
225  bool isRequestedLocale( const Locale & locale_r ) const;
226 
227 
229  void initRequestedLocales( const LocaleSet & locales_r );
230 
232  const LocaleSet & getAddedRequestedLocales() const;
233 
235  const LocaleSet & getRemovedRequestedLocales() const;
236 
237 
242  const LocaleSet & getAvailableLocales() const;
243 
245  bool isAvailableLocale( const Locale & locale_r ) const;
247 
248  public:
256  const MultiversionList & multiversion() const;
260 
261  public:
265  Queue autoInstalled() const;
267  void setAutoInstalled( const Queue & autoInstalled_r );
269 
270  public:
274  void setNeedrebootSpec( sat::SolvableSpec needrebootSpec_r );
276 
277  public:
279  detail::CPool * get() const;
280  private:
282  Pool() {}
283  };
285 
287  std::ostream & operator<<( std::ostream & str, const Pool & obj );
288 
290  inline bool operator==( const Pool & lhs, const Pool & rhs )
291  { return lhs.get() == rhs.get(); }
292 
294  inline bool operator!=( const Pool & lhs, const Pool & rhs )
295  { return lhs.get() != rhs.get(); }
296 
298  void updateSolvFileIndex( const Pathname & solvfile_r );
299 
301  } // namespace sat
304 } // namespace zypp
306 #endif // ZYPP_SAT_POOL_H