libzypp  15.28.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 #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 
37  //
38  // CLASS NAME : Pool
39  //
44  class Pool : protected detail::PoolMember
45  {
46  public:
50 
51  public:
53  static Pool instance()
54  { return Pool(); }
55 
58  {}
59 
60  public:
62  size_type capacity() const;
63 
65  const SerialNumber & serial() const;
66 
68  void prepare() const;
69 
71  void prepareForSolving() const;
72 
74  Pathname rootDir() const;
75 
77  void rootDir( const Pathname & root_r );
78 
79  public:
81  bool reposEmpty() const;
82 
84  size_type reposSize() const;
85 
88 
91 
94  { return makeIterable( reposBegin(), reposEnd() ); }
95 
100  Repository reposInsert( const std::string & alias_r );
101 
105  Repository reposFind( const std::string & alias_r ) const;
106 
110  void reposErase( const std::string & alias_r )
111  { reposFind( alias_r ).eraseFromPool(); }
112 
113  public:
115  static const std::string & systemRepoAlias();
116 
118  Repository findSystemRepo() const;
119 
122 
123  public:
129  Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
131  Repository addRepoSolv( const Pathname & file_r );
135  Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
136 
137  public:
144  Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
146  Repository addRepoHelix( const Pathname & file_r );
150  Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
151 
152  public:
154  bool solvablesEmpty() const;
155 
157  size_type solvablesSize() const;
158 
161 
164 
167  { return makeIterable( solvablesBegin(), solvablesEnd() ); }
168 
169  public:
172  template<class TFilter>
173  filter_iterator<TFilter,SolvableIterator> filterBegin( const TFilter & filter_r ) const
174  { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
175 
176  template<class TFilter>
177  filter_iterator<TFilter,SolvableIterator> filterEnd( const TFilter & filter_r ) const
178  { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
180 
181  public:
184  { return WhatProvides( cap_r ); }
185 
186  public:
192  void setTextLocale( const Locale & locale_r );
193 
198  void setRequestedLocales( const LocaleSet & locales_r );
199 
203  bool addRequestedLocale( const Locale & locale_r );
204 
208  bool eraseRequestedLocale( const Locale & locale_r );
209 
213  const LocaleSet & getRequestedLocales() const;
214 
216  bool isRequestedLocale( const Locale & locale_r ) const;
217 
218 
220  void initRequestedLocales( const LocaleSet & locales_r );
221 
223  const LocaleSet & getAddedRequestedLocales() const;
224 
226  const LocaleSet & getRemovedRequestedLocales() const;
227 
228 
233  const LocaleSet & getAvailableLocales() const;
234 
236  bool isAvailableLocale( const Locale & locale_r ) const;
238 
239  public:
247  const MultiversionList & multiversion() const;
251 
252  public:
256  Queue autoInstalled() const;
258  void setAutoInstalled( const Queue & autoInstalled_r );
260 
261  public:
263  detail::CPool * get() const;
264  private:
266  Pool() {}
267  };
269 
271  std::ostream & operator<<( std::ostream & str, const Pool & obj );
272 
274  inline bool operator==( const Pool & lhs, const Pool & rhs )
275  { return lhs.get() == rhs.get(); }
276 
278  inline bool operator!=( const Pool & lhs, const Pool & rhs )
279  { return lhs.get() != rhs.get(); }
280 
282  void updateSolvFileIndex( const Pathname & solvfile_r );
283 
285  } // namespace sat
288 } // namespace zypp
290 #endif // ZYPP_SAT_POOL_H
Repository reposInsert(const std::string &alias_r)
Return a Repository named alias_r.
Definition: Pool.cc:122
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:215
size_type reposSize() const
Number of repos in Pool.
Definition: Pool.cc:73
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition: Pool.cc:212
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
Definition: Pool.cc:119
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:244
bool isRequestedLocale(const Locale &locale_r) const
Whether this Locale is in the set of requested locales.
Definition: Pool.cc:227
detail::CPool * get() const
Expert backdoor.
Definition: Pool.cc:49
What is known about a repository.
Definition: RepoInfo.h:72
const MultiversionList & multiversion() const
Definition: Pool.cc:240
bool operator==(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:274
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:188
Iterable< SolvableIterator > solvables() const
Iterate the solvables.
Definition: Pool.h:166
void reposErase(const std::string &alias_r)
Remove a Repository named alias_r.
Definition: Pool.h:110
const SerialNumber & serial() const
Housekeeping data serial number.
Definition: Pool.cc:55
size_type solvablesSize() const
Number of solvables in Pool.
Definition: Pool.cc:103
RepositoryIterator reposEnd() const
Iterator behind the last Repository.
Definition: Pool.cc:87
size_type capacity() const
Internal array size for stats only.
Definition: Pool.cc:52
Repository systemRepo()
Return the system repository, create it if missing.
Definition: Pool.cc:157
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
Definition: Pool.cc:230
ZYPP_DEPRECATED bool multiversionEmpty() const
Definition: Pool.h:249
Pool(const detail::PoolMember &)
Ctor from PoolMember.
Definition: Pool.h:57
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
Definition: Pool.cc:232
static Pool instance()
Singleton ctor.
Definition: Pool.h:53
Backlink to the associated PoolImpl.
Definition: PoolMember.h:114
filter_iterator< TFilter, SolvableIterator > filterEnd(const TFilter &filter_r) const
Definition: Pool.h:177
static const std::string & systemRepoAlias()
Reserved system repository alias .
Definition: Pool.cc:46
zypp::detail::RepositoryIterator RepositoryIterator
Definition: Pool.h:48
bool empty() const
Whether the set is epmty.
Definition: SolvableSet.h:59
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
Definition: Pool.cc:243
bool reposEmpty() const
Whether Pool contains repos.
Definition: Pool.cc:70
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
Definition: Pool.cc:142
RepositoryIterator reposBegin() const
Iterator to the first Repository.
Definition: Pool.cc:76
Pathname rootDir() const
Get rootdir (for file conflicts check)
Definition: Pool.cc:64
void updateSolvFileIndex(const Pathname &solvfile_r)
Create solv file content digest for zypper bash completion.
Definition: Pool.cc:263
detail::SolvableIterator SolvableIterator
Definition: Pool.h:47
bool addRequestedLocale(const Locale &locale_r)
Add one Locale to the set of requested locales.
Definition: Pool.cc:218
SolvableIdType size_type
Definition: PoolMember.h:152
Simple serial number provider.
Definition: SerialNumber.h:44
'Language[_Country]' codes.
Definition: Locale.h:49
WhatProvides whatProvides(Capability cap_r) const
Conainer of all Solvable providing cap_r.
Definition: Pool.h:183
Libsolv Id queue wrapper.
Definition: Queue.h:34
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
Definition: Pool.cc:231
detail::size_type size_type
Definition: Pool.h:49
Pool()
Default ctor.
Definition: Pool.h:266
const LocaleSet & getRequestedLocales() const
Return the requested locales.
Definition: Pool.cc:224
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:237
void prepare() const
Update housekeeping data if necessary (e.g.
Definition: Pool.cc:58
void eraseFromPool()
Remove this Repository from it's Pool.
Definition: Repository.cc:297
Global sat-pool.
Definition: Pool.h:44
filter_iterator< TFilter, SolvableIterator > filterBegin(const TFilter &filter_r) const
Definition: Pool.h:173
SolvableIterator solvablesBegin() const
Iterator to the first Solvable.
Definition: Pool.cc:116
const LocaleSet & getAvailableLocales() const
Get the set of available locales.
Definition: Pool.cc:234
bool operator!=(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:278
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:164
bool solvablesEmpty() const
Whether Pool contains solvables.
Definition: Pool.cc:90
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3...
Definition: APIConfig.h:86
Repository findSystemRepo() const
Return the system repository if it is on the pool.
Definition: Pool.cc:152
bool eraseRequestedLocale(const Locale &locale_r)
Erase one Locale from the set of requested locales.
Definition: Pool.cc:221
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
void prepareForSolving() const
prepare plus some expensive checks done before solving only.
Definition: Pool.cc:61
SolvableSet MultiversionList
Definition: Pool.h:246
Iterable< RepositoryIterator > repos() const
Iterate the repositories.
Definition: Pool.h:93
Solvable set wrapper to allow adding additioanal convenience iterators.
Definition: SolvableSet.h:35