libzypp: zypp/ng/sat/preparedpool.cc Source File

libzypp 17.38.14

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
18namespace 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
40 unsigned PreparedPool::whatProvidesCapabilityId( detail::IdType cap_r ) const
41 {
42 return ::pool_whatprovides( get(), cap_r );
43 }
44
45 detail::IdType PreparedPool::whatProvidesData( unsigned offset_r ) const
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
zypp::sat::SolvAttr
Solvable attribute keys.
Definition SolvAttr.h:41
zyppng::IdStringType::id
IdType id() const
Definition IdStringType.h:123
zyppng::sat::Capability
A sat capability.
Definition capability.h:74
zyppng::sat::Capability::id
sat::detail::IdType id() const
Expert backdoor.
Definition capability.h:301
zyppng::sat::Pool::get
detail::CPool * get() const
Expert backdoor.
Definition pool.h:59
zyppng::sat::Pool::serial
const SerialNumber & serial() const
Serial number changing whenever the content changes.
Definition pool.h:63
zyppng::sat::PreparedPool::whatProvidesData
detail::IdType whatProvidesData(unsigned offset_r) const
Returns the id stored at offset_r in the whatprovidesdata array.
Definition preparedpool.cc:45
zyppng::sat::PreparedPool::_pool
Pool & _pool
Definition preparedpool.h:99
zyppng::sat::PreparedPool::PreparedPool
PreparedPool()=delete
zyppng::sat::PreparedPool::whatMatchesDep
Queue whatMatchesDep(const SolvAttr &, const Capability &) const
All solvables whose attribute attr_r matches dependency cap_r.
Definition preparedpool.cc:50
zyppng::sat::PreparedPool::whatProvidesCapabilityId
unsigned whatProvidesCapabilityId(detail::IdType cap_r) const
Returns the offset into the internal whatprovidesdata array for cap_r.
Definition preparedpool.cc:40
zyppng::sat::PreparedPool::whatMatchesSolvable
Queue whatMatchesSolvable(const SolvAttr &, const Solvable &) const
All solvables whose attribute attr_r matches solvable solv_r.
Definition preparedpool.cc:57
zyppng::sat::PreparedPool::Pool
friend class Pool
Definition preparedpool.h:94
zyppng::sat::PreparedPool::_serialWatcher
SerialNumberWatcher _serialWatcher
Definition preparedpool.h:101
zyppng::sat::PreparedPool::get
detail::CPool * get() const noexcept
Expert backdoor — raw libsolv pool pointer.
Definition preparedpool.cc:31
zyppng::sat::PreparedPool::whatContainsDep
Queue whatContainsDep(const SolvAttr &, const Capability &) const
All solvables whose attribute attr_r contains dependency cap_r.
Definition preparedpool.cc:64
zyppng::sat::Queue
Libsolv Id queue wrapper.
Definition queue.h:37
zyppng::sat::Solvable
A Solvable object within the sat Pool.
Definition solvable.h:66
zyppng::sat::Solvable::id
IdType id() const
Expert backdoor.
Definition solvable.h:342
zyppng::sat::detail::CPool
zypp::sat::detail::CPool CPool
Definition poolconstants.h:36
zyppng::sat::detail::IdType
zypp::sat::detail::IdType IdType
Definition poolconstants.h:43
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
pool.h
preparedpool.h
capability.h
solvable.h