libzypp  14.48.5
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/Queue.h"
23 
25 namespace zypp
26 {
27 
28  class SerialNumber;
29  class RepoInfo;
30 
32  namespace sat
33  {
34 
36  //
37  // CLASS NAME : Pool
38  //
43  class Pool : protected detail::PoolMember
44  {
45  public:
49 
50  public:
52  static Pool instance()
53  { return Pool(); }
54 
57  {}
58 
59  public:
61  size_type capacity() const;
62 
64  const SerialNumber & serial() const;
65 
67  void prepare() const;
68 
70  void prepareForSolving() const;
71 
73  Pathname rootDir() const;
74 
76  void rootDir( const Pathname & root_r );
77 
78  public:
80  bool reposEmpty() const;
81 
83  size_type reposSize() const;
84 
87 
90 
95  Repository reposInsert( const std::string & alias_r );
96 
100  Repository reposFind( const std::string & alias_r ) const;
101 
105  void reposErase( const std::string & alias_r )
106  { reposFind( alias_r ).eraseFromPool(); }
107 
108  public:
110  static const std::string & systemRepoAlias();
111 
113  Repository findSystemRepo() const;
114 
117 
118  public:
124  Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
126  Repository addRepoSolv( const Pathname & file_r );
130  Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
131 
132  public:
139  Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
141  Repository addRepoHelix( const Pathname & file_r );
145  Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
146 
147  public:
149  bool solvablesEmpty() const;
150 
152  size_type solvablesSize() const;
153 
156 
159 
160  public:
163  template<class _Filter>
164  filter_iterator<_Filter,SolvableIterator> filterBegin( const _Filter & filter_r ) const
165  { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
166 
167  template<class _Filter>
168  filter_iterator<_Filter,SolvableIterator> filterEnd( const _Filter & filter_r ) const
169  { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
171 
172  public:
175  { return WhatProvides( cap_r ); }
176 
177  public:
183  void setTextLocale( const Locale & locale_r );
184 
189  void setRequestedLocales( const LocaleSet & locales_r );
190 
194  bool addRequestedLocale( const Locale & locale_r );
195 
199  bool eraseRequestedLocale( const Locale & locale_r );
200 
204  const LocaleSet & getRequestedLocales() const;
205 
207  bool isRequestedLocale( const Locale & locale_r ) const;
208 
213  const LocaleSet & getAvailableLocales() const;
214 
216  bool isAvailableLocale( const Locale & locale_r ) const;
218 
219  public:
225  typedef IdStringSet::const_iterator MultiversionIterator;
226 
227  bool multiversionEmpty() const;
228  size_t multiversionSize() const;
231 
232  bool isMultiversion( IdString ident_r ) const;
234 
235  public:
239  Queue autoInstalled() const;
241  void setAutoInstalled( const Queue & autoInstalled_r );
243 
244  public:
246  detail::CPool * get() const;
247  private:
249  Pool() {}
250  };
252 
254  std::ostream & operator<<( std::ostream & str, const Pool & obj );
255 
257  inline bool operator==( const Pool & lhs, const Pool & rhs )
258  { return lhs.get() == rhs.get(); }
259 
261  inline bool operator!=( const Pool & lhs, const Pool & rhs )
262  { return lhs.get() != rhs.get(); }
263 
265  } // namespace sat
268 } // namespace zypp
270 #endif // ZYPP_SAT_POOL_H
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
Definition: Pool.cc:109
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:202
size_type reposSize() const
Number of repos in Pool.
Definition: Pool.cc:60
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition: Pool.cc:199
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
Definition: Pool.cc:106
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
::_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:86
void setAutoInstalled(const Queue &autoInstalled_r)
Set ident list of all autoinstalled solvables.
Definition: Pool.cc:230
bool isRequestedLocale(const Locale &locale_r) const
Whether this Locale is in the set of requested locales.
Definition: Pool.cc:214
detail::CPool * get() const
Expert backdoor.
Definition: Pool.cc:36
bool isMultiversion(IdString ident_r) const
Definition: Pool.cc:227
What is known about a repository.
Definition: RepoInfo.h:72
Access to the sat-pools string space.
Definition: IdString.h:39
filter_iterator< _Filter, SolvableIterator > filterEnd(const _Filter &filter_r) const
Definition: Pool.h:168
bool operator==(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:257
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:175
void reposErase(const std::string &alias_r)
Remove a Repository named alias_r.
Definition: Pool.h:105
const SerialNumber & serial() const
Housekeeping data serial number.
Definition: Pool.cc:42
size_type solvablesSize() const
Number of solvables in Pool.
Definition: Pool.cc:90
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
Definition: Pool.cc:74
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:144
Pool(const detail::PoolMember &)
Ctor from PoolMember.
Definition: Pool.h:56
static Pool instance()
Singleton ctor.
Definition: Pool.h:52
Backlink to the associated PoolImpl.
Definition: PoolMember.h:114
static const std::string & systemRepoAlias()
Reserved system repository alias .
Definition: Pool.cc:33
zypp::detail::RepositoryIterator RepositoryIterator
Definition: Pool.h:47
IdStringSet::const_iterator MultiversionIterator
Definition: Pool.h:225
MultiversionIterator multiversionEnd() const
Definition: Pool.cc:226
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
Definition: Pool.cc:229
bool reposEmpty() const
Whether Pool contains repos.
Definition: Pool.cc:57
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
Definition: Pool.cc:129
RepositoryIterator reposBegin() const
Iterator to the first Repository.
Definition: Pool.cc:63
Pathname rootDir() const
Get rootdir (for file conflicts check)
Definition: Pool.cc:51
std::tr1::unordered_set< Locale > LocaleSet
Definition: Locale.h:28
bool multiversionEmpty() const
Definition: Pool.cc:223
detail::SolvableIterator SolvableIterator
Definition: Pool.h:46
bool addRequestedLocale(const Locale &locale_r)
Add one Locale to the set of requested locales.
Definition: Pool.cc:205
SolvableIdType size_type
Definition: PoolMember.h:147
Simple serial number provider.
Definition: SerialNumber.h:44
WhatProvides whatProvides(Capability cap_r) const
Conainer of all Solvable providing cap_r.
Definition: Pool.h:174
Libsolv Id queue wrapper.
Definition: Queue.h:34
size_t multiversionSize() const
Definition: Pool.cc:224
detail::size_type size_type
Definition: Pool.h:48
Pool()
Default ctor.
Definition: Pool.h:249
const LocaleSet & getRequestedLocales() const
Return the requested locales.
Definition: Pool.cc:211
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:220
void prepare() const
Update housekeeping data if necessary (e.g.
Definition: Pool.cc:45
void eraseFromPool()
Remove this Repository from it's Pool.
Definition: Repository.cc:297
Global sat-pool.
Definition: Pool.h:43
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
Definition: Pool.cc:103
filter_iterator< _Filter, SolvableIterator > filterBegin(const _Filter &filter_r) const
Definition: Pool.h:164
const LocaleSet & getAvailableLocales() const
Get the set of available locales.
Definition: Pool.cc:217
bool operator!=(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:261
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:151
bool solvablesEmpty() const
Whether Pool contains solvables.
Definition: Pool.cc:77
MultiversionIterator multiversionBegin() const
Definition: Pool.cc:225
Repository findSystemRepo() const
Return the system repository if it is on the pool.
Definition: Pool.cc:139
bool eraseRequestedLocale(const Locale &locale_r)
Erase one Locale from the set of requested locales.
Definition: Pool.cc:208
void prepareForSolving() const
prepare plus some expensive checks done before solving only.
Definition: Pool.cc:48