libzypp 17.37.10

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
17 namespace zypp {
18 DEFINE_PTR_TYPE(KeyRing);
19 class ZConfig;
20}
21
22 namespace zyppng {
23
24 ZYPP_FWD_DECL_TYPE_WITH_REFS( Context );
25 ZYPP_FWD_DECL_TYPE_WITH_REFS( ProgressObserver );
26 ZYPP_FWD_DECL_TYPE_WITH_REFS( Provide );
27
28 using KeyRing = zypp::KeyRing;
29 using KeyRingRef = zypp::KeyRing_Ptr;
30
31 class ContextPrivate;
32
33
38 class Context : public UserInterface
39 {
40 ZYPP_DECLARE_PRIVATE(Context)
41 ZYPP_ADD_CREATE_FUNC(Context)
42
43 public:
44
45 using ProvideType = Provide;
46
47 ZYPP_DECL_PRIVATE_CONSTR(Context);
48
49 template <typename AsyncRes>
50 void execute ( AsyncOpRef<AsyncRes> op ) {
51 if ( op->isReady () )
52 return;
53 return executeImpl( op );
54 }
55
56 ProvideRef provider() const;
57 KeyRingRef keyRing () const;
58 zypp::ZConfig &config();
59
63 zypp::ResPool pool();
64
69 zypp::ResPoolProxy poolProxy();
70
74 zypp::sat::Pool satPool();
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
RepoManager.h
ResPool.h
zypp::KeyRing
Gpg key handling.
Definition KeyRing.h:170
zypp::ResPoolProxy
ResPool::instance().proxy();.
Definition ResPoolProxy.h:36
zypp::ResPool
Global ResObject pool.
Definition ResPool.h:62
zypp::ZConfig
Interim helper class to collect global options and settings.
Definition ZConfig.h:69
zypp::sat::Pool
Global sat-pool.
Definition Pool.h:47
zyppng::ContextPrivate
Definition context_p.h:23
zyppng::Context
Definition context.h:39
zyppng::Context::ProvideType
Provide ProvideType
Definition context.h:45
zyppng::Context::config
zypp::ZConfig & config()
Definition context.cc:43
zyppng::Context::execute
void execute(AsyncOpRef< AsyncRes > op)
Definition context.h:50
zyppng::Context::ZYPP_DECL_PRIVATE_CONSTR
ZYPP_DECL_PRIVATE_CONSTR(Context)
zyppng::Context::executeImpl
void executeImpl(const AsyncOpBaseRef &op)
Definition context.cc:63
zyppng::Context::provider
ProvideRef provider() const
Definition context.cc:32
zyppng::Context::pool
zypp::ResPool pool()
Access to the resolvable pool.
Definition context.cc:48
zyppng::Context::satPool
zypp::sat::Pool satPool()
Access to the sat pool.
Definition context.cc:58
zyppng::Context::poolProxy
zypp::ResPoolProxy poolProxy()
Pool of ui::Selectable.
Definition context.cc:53
zyppng::Context::keyRing
KeyRingRef keyRing() const
Definition context.cc:38
zyppng::ProgressObserver
Definition progressobserver.h:28
zyppng::Provide
Definition provide.h:116
zyppng::UserInterface::UserInterface
UserInterface(UserInterfacePrivate &d)
Definition userinterface.cc:19
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zyppng::detail::is_async_op_v
constexpr bool is_async_op_v
Definition asyncop.h:61
zyppng
Definition MediaNetworkRequestExecutor.h:16
zyppng::AsyncOpRef
std::shared_ptr< AsyncOp< T > > AsyncOpRef
Definition asyncop.h:255
zyppng::KeyRingRef
zypp::KeyRing_Ptr KeyRingRef
Definition context.h:29
zyppng::joinPipeline
auto joinPipeline(ContextRef ctx, AsyncOpRef< T > res)
Definition context.h:81
DEFINE_PTR_TYPE
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639
ZYPP_ADD_CREATE_FUNC
#define ZYPP_ADD_CREATE_FUNC(Class)
Definition zyppglobal.h:205
ZYPP_DECLARE_PRIVATE
#define ZYPP_DECLARE_PRIVATE(Class)
Definition zyppglobal.h:87
ZYPP_FWD_DECL_TYPE_WITH_REFS
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126