libzypp  12.16.5
ResPool.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_RESPOOL_H
13 #define ZYPP_RESPOOL_H
14 
15 #include <iosfwd>
16 
17 #include "zypp/APIConfig.h"
18 #include "zypp/base/Iterator.h"
19 
20 #include "zypp/pool/PoolTraits.h"
21 #include "zypp/PoolItem.h"
22 #include "zypp/Filter.h"
23 
25 namespace zypp
26 {
27 
28  class SerialNumber;
29  class ResPoolProxy;
30  class Resolver;
31 
33  //
34  // CLASS NAME : ResPool
35  //
48  class ResPool
49  {
50  friend std::ostream & operator<<( std::ostream & str, const ResPool & obj );
51 
52  public:
58 
59  public:
61  static ResPool instance();
62 
64  ResPoolProxy proxy() const;
65 
67  Resolver & resolver() const;
68 
69  public:
74  const SerialNumber & serial() const;
75 
76  public:
78  bool empty() const;
80  size_type size() const;
81 
86  { return make_filter_begin( pool::ByPoolItem(), store() ); }
89  { return make_filter_end( pool::ByPoolItem(), store() ); }
91 
92  public:
98  PoolItem find( const sat::Solvable & slv_r ) const;
100  PoolItem find( const ResObject::constPtr & resolvable_r ) const
101  { return( resolvable_r ? find( resolvable_r->satSolvable() ) : PoolItem() ); }
102 
103  public:
106  template<class _Filter>
107  filter_iterator<_Filter,const_iterator> filterBegin( const _Filter & filter_r ) const
108  { return make_filter_begin( filter_r, *this ); }
109 
110  template<class _Filter>
111  filter_iterator<_Filter,const_iterator> filterEnd( const _Filter & filter_r ) const
112  { return make_filter_end( filter_r, *this ); }
114 
134  filter_iterator<filter::ByStatus,const_iterator> byStatusBegin( const filter::ByStatus & filter_r ) const
135  { return make_filter_begin( filter_r, *this ); }
136 
137  filter_iterator<filter::ByStatus,const_iterator> byStatusEnd( const filter::ByStatus & filter_r ) const
138  { return make_filter_end( filter_r, *this ); }
140 
141  public:
146 
147  byIdent_iterator byIdentBegin( const ByIdent & ident_r ) const
148  {
149  return make_transform_iterator( id2item().equal_range( ident_r.get() ).first,
151  }
152 
154  { return byIdentBegin( ByIdent(kind_r,name_r) ); }
155 
156  byIdent_iterator byIdentBegin( ResKind kind_r, const C_Str & name_r ) const
157  { return byIdentBegin( ByIdent(kind_r,name_r) ); }
158 
159  template<class _Res>
161  { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); }
162 
163  template<class _Res>
164  byIdent_iterator byIdentBegin( const C_Str & name_r ) const
165  { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); }
166 
168  byIdent_iterator byIdentBegin( const PoolItem & pi_r ) const
169  { return byIdentBegin( ByIdent(pi_r.satSolvable()) ); }
172  { return byIdentBegin( ByIdent(slv_r) ); }
175  { return byIdentBegin( ByIdent(ident_r) ); }
176 
177 
178  byIdent_iterator byIdentEnd( const ByIdent & ident_r ) const
179  {
180  return make_transform_iterator( id2item().equal_range( ident_r.get() ).second,
182  }
183 
184  byIdent_iterator byIdentEnd( ResKind kind_r, IdString name_r ) const
185  { return byIdentEnd( ByIdent(kind_r,name_r) ); }
186 
187  byIdent_iterator byIdentEnd( ResKind kind_r, const C_Str & name_r ) const
188  { return byIdentEnd( ByIdent(kind_r,name_r) ); }
189 
190  template<class _Res>
192  { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); }
193 
194  template<class _Res>
195  byIdent_iterator byIdentEnd( const C_Str & name_r ) const
196  { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); }
197 
199  byIdent_iterator byIdentEnd( const PoolItem & pi_r ) const
200  { return byIdentEnd( ByIdent(pi_r.satSolvable()) ); }
203  { return byIdentEnd( ByIdent(slv_r) ); }
206  { return byIdentEnd( ByIdent(ident_r) ); }
208 
209  public:
213  typedef filter_iterator<ByKind,const_iterator> byKind_iterator;
214 
215  byKind_iterator byKindBegin( const ResKind & kind_r ) const
216  { return make_filter_begin( ByKind(kind_r), *this ); }
217 
218  template<class _Res>
220  { return make_filter_begin( resfilter::byKind<_Res>(), *this ); }
221 
222  byKind_iterator byKindEnd( const ResKind & kind_r ) const
223  { return make_filter_end( ByKind(kind_r), *this ); }
224 
225  template<class _Res>
227  { return make_filter_end( resfilter::byKind<_Res>(), *this ); }
229 
230  public:
234  typedef filter_iterator<ByName,const_iterator> byName_iterator;
235 
236  byName_iterator byNameBegin( const std::string & name_r ) const
237  { return make_filter_begin( ByName(name_r), *this ); }
238 
239  byName_iterator byNameEnd( const std::string & name_r ) const
240  { return make_filter_end( ByName(name_r), *this ); }
242 
243  public:
246 
248  public:
253 
255 
257 
261  Repository reposFind( const std::string & alias_r ) const;
263 
264  public:
293  void setRequestedLocales( const LocaleSet & locales_r );
294 
298  bool addRequestedLocale( const Locale & locale_r );
299 
303  bool eraseRequestedLocale( const Locale & locale_r );
304 
308  const LocaleSet & getRequestedLocales() const;
309 
311  bool isRequestedLocale( const Locale & locale_r ) const;
312 
317  const LocaleSet & getAvailableLocales() const;
318 
320  bool isAvailableLocale( const Locale & locale_r ) const;
322 
323  public:
338 
339  bool autoSoftLocksEmpty() const;
343 
348  void setAutoSoftLocks( const AutoSoftLocks & newLocks_r );
349 
355  void getActiveSoftLocks( AutoSoftLocks & activeLocks_r );
357 
358  public:
368 
369  bool hardLockQueriesEmpty() const;
373 
378  void setHardLockQueries( const HardLockQueries & newLocks_r );
379 
383  void getHardLockQueries( HardLockQueries & activeLocks_r );
385 
386  private:
387  const pool::PoolTraits::ItemContainerT & store() const;
388  const pool::PoolTraits::Id2ItemT & id2item() const;
389 
390  private:
395  };
397 
399  std::ostream & operator<<( std::ostream & str, const ResPool & obj );
400 
402 } // namespace zypp
404 
405 #include "zypp/ResPoolProxy.h"
406 
407 #endif // ZYPP_RESPOOL_H