libzypp  17.38.7
preparedpool.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
9 #include "preparedpool.h"
10 #include <zypp/ng/sat/pool.h>
11 #include <zypp/ng/sat/capability.h>
12 #include <zypp/ng/sat/solvable.h>
13 
14 #ifndef NDEBUG
15 # include <cassert>
16 #endif
17 
18 namespace zyppng::sat {
19 
20  PreparedPool::PreparedPool( Pool & pool_r ) noexcept
21  : _pool( pool_r )
22 #ifndef NDEBUG
23  , _serialWatcher()
24 #endif
25  {
26 #ifndef NDEBUG
27  _serialWatcher.remember( _pool.serial() );
28 #endif
29  }
30 
31  detail::CPool * PreparedPool::get() const noexcept
32  {
33 #ifndef NDEBUG
34  assert( !_serialWatcher.remember( _pool.serial() )
35  && "PreparedPool used after Pool was invalidated" );
36 #endif
37  return _pool.get();
38  }
39 
41  {
42  return ::pool_whatprovides( get(), cap_r );
43  }
44 
46  {
47  return get()->whatprovidesdata[offset_r];
48  }
49 
50  Queue PreparedPool::whatMatchesDep( const SolvAttr & attr, const Capability & cap ) const
51  {
52  sat::Queue q;
53  ::pool_whatmatchesdep( get(), attr.id(), cap.id(), q, 0 );
54  return q;
55  }
56 
57  Queue PreparedPool::whatMatchesSolvable( const SolvAttr & attr, const Solvable & solv ) const
58  {
59  sat::Queue q;
60  ::pool_whatmatchessolvable( get(), attr.id(), static_cast<Id>( solv.id() ), q, 0 );
61  return q;
62  }
63 
64  Queue PreparedPool::whatContainsDep( const SolvAttr & attr, const Capability & cap ) const
65  {
66  sat::Queue q;
67  ::pool_whatcontainsdep( get(), attr.id(), cap.id(), q, 0 );
68  return q;
69  }
70 
71 } // namespace zyppng::sat
A Solvable object within the sat Pool.
Definition: solvable.h:64
bool remember(unsigned serial_r) const
Return isDirty, storing serial_r as new value.
Definition: SerialNumber.h:160
SerialNumberWatcher _serialWatcher
Definition: preparedpool.h:101
sat::SolvAttr attr
Definition: PoolQuery.cc:312
Orchestrator for a libsolv pool instance.
Definition: pool.h:36
sat::detail::IdType id() const
Expert backdoor.
Definition: capability.h:301
Queue whatMatchesDep(const SolvAttr &, const Capability &) const
All solvables whose attribute attr_r matches dependency cap_r.
Definition: preparedpool.cc:50
zypp::sat::detail::CPool CPool
Definition: poolconstants.h:36
Queue whatContainsDep(const SolvAttr &, const Capability &) const
All solvables whose attribute attr_r contains dependency cap_r.
Definition: preparedpool.cc:64
detail::CPool * get() const noexcept
Expert backdoor — raw libsolv pool pointer.
Definition: preparedpool.cc:31
detail::CPool * get() const
Expert backdoor.
Definition: pool.h:59
This file contains private API, this might break at any time between releases.
Definition: capabilities.h:22
A sat capability.
Definition: capability.h:73
zypp::sat::detail::IdType IdType
Definition: poolconstants.h:43
IdType id() const
Expert backdoor.
Definition: solvable.h:338
Queue whatMatchesSolvable(const SolvAttr &, const Solvable &) const
All solvables whose attribute attr_r matches solvable solv_r.
Definition: preparedpool.cc:57
Libsolv Id queue wrapper.
Definition: queue.h:36
detail::IdType whatProvidesData(unsigned offset_r) const
Returns the id stored at offset_r in the whatprovidesdata array.
Definition: preparedpool.cc:45
unsigned whatProvidesCapabilityId(detail::IdType cap_r) const
Returns the offset into the internal whatprovidesdata array for cap_r.
Definition: preparedpool.cc:40
const SerialNumber & serial() const
Serial number changing whenever the content changes.
Definition: pool.h:63