libzypp 17.31.23
PoolItem.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_POOLITEM_H
13#define ZYPP_POOLITEM_H
14
15#include <iosfwd>
16#include <functional>
17
18#include <zypp/base/PtrTypes.h>
19#include <zypp/ResObject.h>
20
22#include <zypp/ResStatus.h>
23
25namespace zypp
26{
27 class ResPool;
28 namespace pool
29 {
30 class PoolImpl;
31 }
50 class PoolItem : public sat::SolvableType<PoolItem>
51 {
52 friend std::ostream & operator<<( std::ostream & str, const PoolItem & obj );
53 public:
55 PoolItem();
56
58 explicit PoolItem( const sat::Solvable & solvable_r );
59
61 template <class Derived>
62 explicit PoolItem( const SolvableType<Derived> & solvable_r )
63 : PoolItem( solvable_r.satSolvable() )
64 {}
65
67 explicit PoolItem( const ResObject::constPtr & resolvable_r );
68
70 ~PoolItem();
71
72 public:
76 ResStatus & status() const;
77
79 ResStatus & statusReset() const;
80
85 ResStatus & statusReinit() const;
87
88
94 bool isUndetermined() const;
95
99 bool isRelevant() const;
100
102 bool isSatisfied() const;
103
105 bool isBroken() const;
106
110 bool isNeeded() const;
111
113 bool isUnwanted() const;
115
116 public:
118 ResPool pool() const;
119
121 explicit operator sat::Solvable() const
122 { return resolvable() ? resolvable()->satSolvable() : sat::Solvable::noSolvable; }
123
127 sat::Solvable buddy() const;
128
129 public:
134
138 operator ResObject::constPtr() const
139 { return resolvable(); }
140
143 { return resolvable(); }
144
145 private:
146 friend class pool::PoolImpl;
148 static PoolItem makePoolItem( const sat::Solvable & solvable_r );
150 void setBuddy( const sat::Solvable & solv_r );
152 public:
153 struct Impl;
154 private:
155 explicit PoolItem( Impl * implptr_r );
158
159 private:
163 friend struct PoolItemSaver;
164 void saveState() const;
165 void restoreState() const;
166 bool sameState() const;
168 };
170
172 std::ostream & operator<<( std::ostream & str, const PoolItem & obj );
173
174
176 inline bool operator==( const PoolItem & lhs, const PoolItem & rhs )
177 { return lhs.resolvable() == rhs.resolvable(); }
178
180 inline bool operator==( const PoolItem & lhs, const ResObject::constPtr & rhs )
181 { return lhs.resolvable() == rhs; }
182
184 inline bool operator==( const ResObject::constPtr & lhs, const PoolItem & rhs )
185 { return lhs == rhs.resolvable(); }
186
187
189 inline bool operator!=( const PoolItem & lhs, const PoolItem & rhs )
190 { return ! (lhs==rhs); }
191
193 inline bool operator!=( const PoolItem & lhs, const ResObject::constPtr & rhs )
194 { return ! (lhs==rhs); }
195
197 inline bool operator!=( const ResObject::constPtr & lhs, const PoolItem & rhs )
198 { return ! (lhs==rhs); }
199
205 {
207
208 PoolItem operator()( const sat::Solvable & solv_r ) const
209 { return PoolItem( solv_r ); }
210 };
211
212} // namespace zypp
214#endif // ZYPP_POOLITEM_H
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:51
bool isRelevant() const
Returns true if the solvable is relevant which means e.g.
Definition: PoolItem.cc:217
bool isNeeded() const
This includes unlocked broken patches, as well as those already selected to be installed (otherwise c...
Definition: PoolItem.cc:220
friend std::ostream & operator<<(std::ostream &str, const PoolItem &obj)
Definition: PoolItem.cc:229
bool operator==(const PoolItem &lhs, const ResObject::constPtr &rhs)
Convenience compare.
Definition: PoolItem.h:180
bool operator!=(const ResObject::constPtr &lhs, const PoolItem &rhs)
Convenience compare.
Definition: PoolItem.h:197
void restoreState() const
Definition: PoolItem.cc:224
void saveState() const
Definition: PoolItem.cc:223
ResObject::constPtr resolvable() const
Returns the ResObject::constPtr.
Definition: PoolItem.cc:226
bool sameState() const
Definition: PoolItem.cc:225
bool operator!=(const PoolItem &lhs, const ResObject::constPtr &rhs)
Convenience compare.
Definition: PoolItem.h:193
bool isBroken() const
Whether a relevant items requirements are broken.
Definition: PoolItem.cc:219
ResStatus & status() const
Returns the current status.
Definition: PoolItem.cc:211
void setBuddy(const sat::Solvable &solv_r)
Buddies are set by pool::PoolImpl.
Definition: PoolItem.cc:215
bool isSatisfied() const
Whether a relevant items requirements are met.
Definition: PoolItem.cc:218
PoolItem(const SolvableType< Derived > &solvable_r)
Ctor looking up the sat::Solvable in the ResPool.
Definition: PoolItem.h:62
bool isUnwanted() const
Broken (needed) but locked patches.
Definition: PoolItem.cc:221
bool operator==(const PoolItem &lhs, const PoolItem &rhs)
Required to disambiguate vs.
Definition: PoolItem.h:176
static PoolItem makePoolItem(const sat::Solvable &solvable_r)
PoolItem generator for pool::PoolImpl.
Definition: PoolItem.cc:199
~PoolItem()
Dtor.
Definition: PoolItem.cc:204
ResStatus & statusReset() const
Resets status to the default state (KEEP_STATE bySOLVER; clears any lock!).
Definition: PoolItem.cc:212
ResPool pool() const
Return the ResPool the item belongs to.
Definition: PoolItem.cc:207
PoolItem()
Default ctor for use in std::container.
Definition: PoolItem.cc:183
sat::Solvable buddy() const
Return the buddy we share our status object with.
Definition: PoolItem.cc:214
RW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: PoolItem.h:157
ResObject::constPtr operator->() const
Forward -> access to ResObject.
Definition: PoolItem.h:142
bool operator==(const ResObject::constPtr &lhs, const PoolItem &rhs)
Convenience compare.
Definition: PoolItem.h:184
bool isUndetermined() const
No validation is performed for packages.
Definition: PoolItem.cc:216
ResStatus & statusReinit() const
Resets status to it's initial state in the ResPool (KEEP_STATE bySOLVER or LOCKED byUSER).
Definition: PoolItem.cc:213
bool operator!=(const PoolItem &lhs, const PoolItem &rhs)
Required to disambiguate vs.
Definition: PoolItem.h:189
TraitsType::constPtrType constPtr
Definition: ResObject.h:43
Global ResObject pool.
Definition: ResPool.h:61
Status bitfield.
Definition: ResStatus.h:54
A Solvable object within the sat Pool.
Definition: Solvable.h:54
static const Solvable noSolvable
Represents no Solvable.
Definition: Solvable.h:75
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
PoolItem implementation.
Definition: PoolItem.cc:38
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:286
Solvable to PoolItem transform functor.
Definition: PoolItem.h:205
PoolItem operator()(const sat::Solvable &solv_r) const
Definition: PoolItem.h:208
PoolItem result_type
Definition: PoolItem.h:206
Base class for creating Solvable based types.
Definition: SolvableType.h:55
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57