AusweisApp
Lade ...
Suche ...
Keine Treffer
WorkflowRequest.h
gehe zur Dokumentation dieser Datei
1
5#pragma once
6
8
9#include <QPair>
10#include <QVariant>
11
12#include <functional>
13#include <utility>
14
15namespace governikus
16{
18 , UNHANDLED
19 , SKIP
20 , ENQUEUE
21 )
22
24
26{
28
29 using BusyHandler = std::function<WorkflowControl (const QSharedPointer<WorkflowRequest>&, const QSharedPointer<WorkflowRequest>&)>;
30
31 private:
32 const std::function<QSharedPointer<WorkflowController>(const QSharedPointer<WorkflowContext>& pContext)> mGeneratorController;
33 const std::function<QSharedPointer<WorkflowContext>()> mGeneratorContext;
34 const BusyHandler mBusyHandler;
35 const QVariant mData;
36
39
40 template<typename Controller, typename Context, typename ... Args>
41 static auto getGenerator(Args&& ... pArgs)
42 {
44 return QSharedPointer<Controller>::create(pContext.staticCast<Context>());
45 };
46
47 const auto& context = [pArgs ...]() mutable {
48 return QSharedPointer<Context>::create(std::forward<Args>(pArgs) ...);
49 };
50
52 }
53
54 public:
55 template<typename Controller, typename Context, typename Request = WorkflowRequest, typename ... Args>
57 {
58 auto [controller, context] = getGenerator<Controller, Context, Args...>(std::forward<Args>(pArgs) ...);
59 return QSharedPointer<Request>::create(controller, context);
60 }
61
62
63 template<typename Controller, typename Context, typename Request = WorkflowRequest, typename ... Args>
65 {
66 return createHandler<Controller, Context, Request, Args...>(pBusyHandler, QVariant(), std::forward<Args>(pArgs) ...);
67 }
68
69
70 template<typename Controller, typename Context, typename Request = WorkflowRequest, typename ... Args>
72 {
73 return createHandler<Controller, Context, Request, Args...>(BusyHandler(), pData, std::forward<Args>(pArgs) ...);
74 }
75
76
77 template<typename Controller, typename Context, typename Request = WorkflowRequest, typename ... Args>
79 {
80 auto [controller, context] = getGenerator<Controller, Context, Args...>(std::forward<Args>(pArgs) ...);
81 return QSharedPointer<Request>::create(controller, context, pBusyHandler, pData);
82 }
83
84
87 const BusyHandler& pHandler = BusyHandler(),
88 const QVariant& pData = QVariant());
89
90 void initialize();
91 [[nodiscard]] bool isInitialized() const;
92 [[nodiscard]] Action getAction() const;
95 [[nodiscard]] QVariant getData() const;
97};
98
99} // namespace governikus
#define defineEnumType(enumName,...)
Definition EnumHelper.h:90
Definition WorkflowController.h:24
Definition WorkflowRequest.h:26
Action getAction() const
Definition WorkflowRequest.cpp:43
void initialize()
Definition WorkflowRequest.cpp:28
static QSharedPointer< WorkflowRequest > createHandler(const BusyHandler &pBusyHandler, const QVariant &pData, Args &&... pArgs)
Definition WorkflowRequest.h:78
QSharedPointer< WorkflowContext > getContext() const
Definition WorkflowRequest.cpp:55
WorkflowRequest(const std::function< QSharedPointer< WorkflowController >(const QSharedPointer< WorkflowContext > &pContext)> &pGeneratorController, const std::function< QSharedPointer< WorkflowContext >()> &pGeneratorContext, const BusyHandler &pHandler=BusyHandler(), const QVariant &pData=QVariant())
QSharedPointer< WorkflowController > getController() const
Definition WorkflowRequest.cpp:49
static QSharedPointer< WorkflowRequest > create(Args &&... pArgs)
Definition WorkflowRequest.h:56
QVariant getData() const
Definition WorkflowRequest.cpp:61
bool isInitialized() const
Definition WorkflowRequest.cpp:37
static QSharedPointer< WorkflowRequest > createHandler(const BusyHandler &pBusyHandler, Args &&... pArgs)
Definition WorkflowRequest.h:64
WorkflowControl handleBusyWorkflow(const QSharedPointer< WorkflowRequest > &pActiveWorkflow, const QSharedPointer< WorkflowRequest > &pWaitingWorkflow) const
Definition WorkflowRequest.cpp:67
static QSharedPointer< WorkflowRequest > createHandler(const QVariant &pData, Args &&... pArgs)
Definition WorkflowRequest.h:71
Implementation of GeneralAuthenticate response APDUs.
Definition CommandApdu.h:16
QSharedPointer< T > decodeObject(const QByteArray &pData, bool pLogging=true)
Template function for decoding an OpenSSL type from DER encoded QByteArray.
Definition ASN1TemplateUtil.h:114