libzypp  14.29.1
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 
72  public:
74  bool reposEmpty() const;
75 
77  size_type reposSize() const;
78 
80  RepositoryIterator reposBegin() const;
81 
83  RepositoryIterator reposEnd() const;
84 
89  Repository reposInsert( const std::string & alias_r );
90 
94  Repository reposFind( const std::string & alias_r ) const;
95 
99  void reposErase( const std::string & alias_r )
100  { reposFind( alias_r ).eraseFromPool(); }
101 
102  public:
104  static const std::string & systemRepoAlias();
105 
107  Repository findSystemRepo() const;
108 
111 
112  public:
118  Repository addRepoSolv( const Pathname & file_r, const std::string & name_r );
120  Repository addRepoSolv( const Pathname & file_r );
124  Repository addRepoSolv( const Pathname & file_r, const RepoInfo & info_r );
125 
126  public:
133  Repository addRepoHelix( const Pathname & file_r, const std::string & name_r );
135  Repository addRepoHelix( const Pathname & file_r );
139  Repository addRepoHelix( const Pathname & file_r, const RepoInfo & info_r );
140 
141  public:
143  bool solvablesEmpty() const;
144 
146  size_type solvablesSize() const;
147 
149  SolvableIterator solvablesBegin() const;
150 
152  SolvableIterator solvablesEnd() const;
153 
154  public:
157  template<class _Filter>
158  filter_iterator<_Filter,SolvableIterator> filterBegin( const _Filter & filter_r ) const
159  { return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
160 
161  template<class _Filter>
162  filter_iterator<_Filter,SolvableIterator> filterEnd( const _Filter & filter_r ) const
163  { return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
165 
166  public:
169  { return WhatProvides( cap_r ); }
170 
171  public:
177  void setTextLocale( const Locale & locale_r );
178 
183  void setRequestedLocales( const LocaleSet & locales_r );
184 
188  bool addRequestedLocale( const Locale & locale_r );
189 
193  bool eraseRequestedLocale( const Locale & locale_r );
194 
198  const LocaleSet & getRequestedLocales() const;
199 
201  bool isRequestedLocale( const Locale & locale_r ) const;
202 
207  const LocaleSet & getAvailableLocales() const;
208 
210  bool isAvailableLocale( const Locale & locale_r ) const;
212 
213  public:
219  typedef IdStringSet::const_iterator MultiversionIterator;
220 
221  bool multiversionEmpty() const;
222  size_t multiversionSize() const;
223  MultiversionIterator multiversionBegin() const;
224  MultiversionIterator multiversionEnd() const;
225 
226  bool isMultiversion( IdString ident_r ) const;
228 
229  public:
233  Queue autoInstalled() const;
235  void setAutoInstalled( const Queue & autoInstalled_r );
237 
238  public:
240  ::_Pool * get() const;
241  private:
243  Pool() {}
244  };
246 
248  std::ostream & operator<<( std::ostream & str, const Pool & obj );
249 
251  inline bool operator==( const Pool & lhs, const Pool & rhs )
252  { return lhs.get() == rhs.get(); }
253 
255  inline bool operator!=( const Pool & lhs, const Pool & rhs )
256  { return lhs.get() != rhs.get(); }
257 
259  } // namespace sat
262 } // namespace zypp
264 #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
size_type reposSize() const
Number of repos in Pool.
Definition: Pool.cc:54
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition: Pool.cc:193
SolvableIterator solvablesEnd() const
Iterator behind the last Solvable.
Definition: Pool.cc:100
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
String related utilities and Regular expression matching.
void setAutoInstalled(const Queue &autoInstalled_r)
Set ident list of all autoinstalled solvables.
Definition: Pool.cc:224
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:162
bool operator==(const Pool &lhs, const Pool &rhs)
Definition: Pool.h:251
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:99
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
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:56
static Pool instance()
Singleton ctor.
Definition: Pool.h:52
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:47
IdStringSet::const_iterator MultiversionIterator
Definition: Pool.h:219
MultiversionIterator multiversionEnd() const
Definition: Pool.cc:220
Queue autoInstalled() const
Get ident list of all autoinstalled solvables.
Definition: Pool.cc:223
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:46
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:168
Libsolv Id queue wrapper.
Definition: Queue.h:38
size_t multiversionSize() const
Definition: Pool.cc:218
detail::size_type size_type
Definition: Pool.h:48
Pool()
Default ctor.
Definition: Pool.h:243
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's Pool.
Definition: Repository.cc:297
Global sat-pool.
Definition: Pool.h:43
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:158
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:255
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
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
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