libzypp  13.10.6
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 
24 namespace zypp
25 {
26 
27  class SerialNumber;
28  class RepoInfo;
29 
31  namespace sat
32  {
33 
35  //
36  // CLASS NAME : Pool
37  //
42  class Pool : protected detail::PoolMember
43  {
44  public:
48 
49  public:
51  static Pool instance()
52  { return Pool(); }
53 
56  {}
57 
58  public:
60  size_type capacity() const;
61 
63  const SerialNumber & serial() const;
64 
66  void prepare() const;
67 
69  void prepareForSolving() const;
70 
71  public:
73  bool reposEmpty() const;
74 
76  size_type reposSize() const;
77 
80 
83 
88  Repository reposInsert( const std::string & alias_r );
89 
93  Repository reposFind( const std::string & alias_r ) const;
94 
98  void reposErase( const std::string & alias_r )
99  { reposFind( alias_r ).eraseFromPool(); }
100 
101  public:
103  static const std::string & systemRepoAlias();
104 
106  Repository findSystemRepo() const;
107 
110 
111  public:
117  Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
119  Repository addRepoSolv( const Pathname & file_r );
123  Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
124 
125  public:
132  Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
134  Repository addRepoHelix( const Pathname & file_r );
138  Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
139 
140  public:
142  bool solvablesEmpty() const;
143 
145  size_type solvablesSize() const;
146 
149 
152 
153  public:
156  template<class _Filter>
157  filter_iterator<_Filter,SolvableIterator> filterBegin( const _Filter & filter_r ) const
158  { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
159 
160  template<class _Filter>
161  filter_iterator<_Filter,SolvableIterator> filterEnd( const _Filter & filter_r ) const
162  { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
164 
165  public:
168  { return WhatProvides( cap_r ); }
169 
170  public:
176  void setTextLocale( const Locale & locale_r );
177 
182  void setRequestedLocales( const LocaleSet & locales_r );
183 
187  bool addRequestedLocale( const Locale & locale_r );
188 
192  bool eraseRequestedLocale( const Locale & locale_r );
193 
197  const LocaleSet & getRequestedLocales() const;
198 
200  bool isRequestedLocale( const Locale & locale_r ) const;
201 
206  const LocaleSet & getAvailableLocales() const;
207 
209  bool isAvailableLocale( const Locale & locale_r ) const;
211 
212  public:
218  typedef IdStringSet::const_iterator MultiversionIterator;
219 
220  bool multiversionEmpty() const;
221  size_t multiversionSize() const;
224 
225  bool isMultiversion( IdString ident_r ) const;
227 
228  public:
233  typedef IdStringSet::const_iterator OnSystemByUserIterator;
234 
235  bool onSystemByUserEmpty() const;
236  size_t onSystemByUserSize() const;
239 
240  bool isOnSystemByUser( IdString ident_r ) const;
242 
243  public:
245  ::_Pool * get() const;
246  private:
248  Pool() {}
249  };
251 
253  std::ostream & operator<<( std::ostream & str, const Pool & obj );
254 
256  inline bool operator==( const Pool & lhs, const Pool & rhs )
257  { return lhs.get() == rhs.get(); }
258 
260  inline bool operator!=( const Pool & lhs, const Pool & rhs )
261  { return lhs.get() != rhs.get(); }
262 
264  } // namespace sat
267 } // namespace zypp
269 #endif // ZYPP_SAT_POOL_H
::_Pool * get() const
Expert backdoor.
Definition: Pool.cc:36
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
Definition: Pool.cc:103
Container of Solvable providing a Capability (read only).
Definition: WhatProvides.h:87
void setRequestedLocales(const LocaleSet &locales_r)
Set the requested locales.
Definition: Pool.cc:196
OnSystemByUserIterator onSystemByUserBegin() const
Definition: Pool.cc:225
size_type reposSize() const
Number of repos in Pool.
Definition: Pool.cc:54
std::ostream & operator<<(std::ostream &str, const LocaleSupport &obj)
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition: Pool.cc:193
bool onSystemByUserEmpty() const
Definition: Pool.cc:223
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
Definition: Pool.cc:100
bool isRequestedLocale(const Locale &locale_r) const
Whether this Locale is in the set of requested locales.
Definition: Pool.cc:208
bool isMultiversion(IdString ident_r) const
Definition: Pool.cc:221
What is known about a repository.
Definition: RepoInfo.h:66
Access to the sat-pools string space.
Definition: IdString.h:39
filter_iterator< _Filter, SolvableIterator > filterEnd(const _Filter &filter_r) const
Definition: Pool.h:161
bool operator==(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:256
IdStringSet::const_iterator OnSystemByUserIterator
Definition: Pool.h:233
Repository addRepoHelix(const Pathname &file_r, const std::string &name_r)
Load Solvables from a helix-file into a Repository named name_r.
Definition: Pool.cc:169
void reposErase(const std::string &alias_r)
Remove a Repository named alias_r.
Definition: Pool.h:98
const SerialNumber & serial() const
Housekeeping data serial number.
Definition: Pool.cc:42
size_type solvablesSize() const
Number of solvables in Pool.
Definition: Pool.cc:84
size_t onSystemByUserSize() const
Definition: Pool.cc:224
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
Definition: Pool.cc:68
size_type capacity() const
Internal array size for stats only.
Definition: Pool.cc:39
Repository systemRepo()
Return the system repository, create it if missing.
Definition: Pool.cc:138
Pool(const detail::PoolMember &)
Ctor from PoolMember.
Definition: Pool.h:55
static Pool instance()
Singleton ctor.
Definition: Pool.h:51
Backlink to the associated PoolImpl.
Definition: PoolMember.h:66
static const std::string & systemRepoAlias()
Reserved system repository alias .
Definition: Pool.cc:33
zypp::detail::RepositoryIterator RepositoryIterator
Definition: Pool.h:46
bool isOnSystemByUser(IdString ident_r) const
Definition: Pool.cc:227
IdStringSet::const_iterator MultiversionIterator
Definition: Pool.h:218
MultiversionIterator multiversionEnd() const
Definition: Pool.cc:220
bool reposEmpty() const
Whether Pool contains repos.
Definition: Pool.cc:51
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
Definition: Pool.cc:123
RepositoryIterator reposBegin() const
Iterator to the first Repository.
Definition: Pool.cc:57
std::tr1::unordered_set< Locale > LocaleSet
Definition: Locale.h:28
bool multiversionEmpty() const
Definition: Pool.cc:217
detail::SolvableIterator SolvableIterator
Definition: Pool.h:45
bool addRequestedLocale(const Locale &locale_r)
Add one Locale to the set of requested locales.
Definition: Pool.cc:199
SolvableIdType size_type
Definition: PoolMember.h:99
Simple serial number provider.
Definition: SerialNumber.h:44
WhatProvides whatProvides(Capability cap_r) const
Conainer of all Solvable providing cap_r.
Definition: Pool.h:167
OnSystemByUserIterator onSystemByUserEnd() const
Definition: Pool.cc:226
size_t multiversionSize() const
Definition: Pool.cc:218
detail::size_type size_type
Definition: Pool.h:47
Pool()
Default ctor.
Definition: Pool.h:248
const LocaleSet & getRequestedLocales() const
Return the requested locales.
Definition: Pool.cc:205
A sat capability.
Definition: Capability.h:59
bool isAvailableLocale(const Locale &locale_r) const
Whether this Locale is in the set of available locales.
Definition: Pool.cc:214
void prepare() const
Update housekeeping data if necessary (e.g.
Definition: Pool.cc:45
void eraseFromPool()
Remove this Repository from it&#39;s Pool.
Definition: Repository.cc:225
Global sat-pool.
Definition: Pool.h:42
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
Definition: Pool.cc:97
filter_iterator< _Filter, SolvableIterator > filterBegin(const _Filter &filter_r) const
Definition: Pool.h:157
const LocaleSet & getAvailableLocales() const
Get the set of available locales.
Definition: Pool.cc:211
bool operator!=(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:260
Repository addRepoSolv(const Pathname &file_r, const std::string &name_r)
Load Solvables from a solv-file into a Repository named name_r.
Definition: Pool.cc:145
bool solvablesEmpty() const
Whether Pool contains solvables.
Definition: Pool.cc:71
MultiversionIterator multiversionBegin() const
Definition: Pool.cc:219
Repository findSystemRepo() const
Return the system repository if it is on the pool.
Definition: Pool.cc:133
bool eraseRequestedLocale(const Locale &locale_r)
Erase one Locale from the set of requested locales.
Definition: Pool.cc:202
void prepareForSolving() const
prepare plus some expensive checks done before solving only.
Definition: Pool.cc:48