libzypp 17.37.17
context.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#ifndef ZYPP_NG_CONTEXT_INCLUDED
10#define ZYPP_NG_CONTEXT_INCLUDED
11
12#include <zypp-core/zyppng/async/AsyncOp>
13#include <zypp-core/zyppng/ui/UserInterface>
14#include <zypp/RepoManager.h>
15#include <zypp/ResPool.h>
16
17namespace zypp {
19 class ZConfig;
20}
21
22namespace zyppng {
23
27
29 using KeyRingRef = zypp::KeyRing_Ptr;
30
31 class ContextPrivate;
32
33
38 class Context : public UserInterface
39 {
42
43 public:
44
46
48
49 template <typename AsyncRes>
51 if ( op->isReady () )
52 return;
53 return executeImpl( op );
54 }
55
56 ProvideRef provider() const;
57 KeyRingRef keyRing () const;
59
64
70
75
76 private:
77 void executeImpl ( const AsyncOpBaseRef& op );
78 };
79
80 template<typename T>
81 auto joinPipeline( ContextRef ctx, AsyncOpRef<T> res ) {
82 if constexpr ( detail::is_async_op_v<decltype(res)> ) {
83 ctx->execute(res);
84 return res->get();
85 } else {
86 return res;
87 }
88 }
89
90}
91
92
93#endif
Gpg key handling.
Definition KeyRing.h:170
ResPool::instance().proxy();.
Global ResObject pool.
Definition ResPool.h:62
Interim helper class to collect global options and settings.
Definition ZConfig.h:69
Global sat-pool.
Definition Pool.h:47
Provide ProvideType
Definition context.h:45
zypp::ZConfig & config()
Definition context.cc:43
void execute(AsyncOpRef< AsyncRes > op)
Definition context.h:50
ZYPP_DECL_PRIVATE_CONSTR(Context)
void executeImpl(const AsyncOpBaseRef &op)
Definition context.cc:63
ProvideRef provider() const
Definition context.cc:32
zypp::ResPool pool()
Access to the resolvable pool.
Definition context.cc:48
zypp::sat::Pool satPool()
Access to the sat pool.
Definition context.cc:58
zypp::ResPoolProxy poolProxy()
Pool of ui::Selectable.
Definition context.cc:53
KeyRingRef keyRing() const
Definition context.cc:38
UserInterface(UserInterfacePrivate &d)
Easy-to use interface to the ZYPP dependency resolver.
constexpr bool is_async_op_v
Definition asyncop.h:61
std::shared_ptr< AsyncOp< T > > AsyncOpRef
Definition asyncop.h:255
zypp::KeyRing_Ptr KeyRingRef
Definition context.h:29
auto joinPipeline(ContextRef ctx, AsyncOpRef< T > res)
Definition context.h:81
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639
#define ZYPP_ADD_CREATE_FUNC(Class)
Definition zyppglobal.h:205
#define ZYPP_DECLARE_PRIVATE(Class)
Definition zyppglobal.h:87
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126