29 using BusyHandler = std::function<WorkflowControl (
const QSharedPointer<WorkflowRequest>&,
const QSharedPointer<WorkflowRequest>&)>;
32 const std::function<QSharedPointer<WorkflowController>(
const QSharedPointer<WorkflowContext>& pContext)> mGeneratorController;
33 const std::function<QSharedPointer<WorkflowContext>()> mGeneratorContext;
34 const BusyHandler mBusyHandler;
37 QSharedPointer<WorkflowController> mController;
38 QSharedPointer<WorkflowContext> mContext;
40 template<
typename Controller,
typename Context,
typename ... Args>
41 static auto getGenerator(Args&& ... pArgs)
43 const auto& controller = [](
const QSharedPointer<WorkflowContext>& pContext){
44 return QSharedPointer<Controller>::create(pContext.staticCast<Context>());
47 const auto& context = [pArgs ...]()
mutable {
48 return QSharedPointer<Context>::create(std::forward<Args>(pArgs) ...);
51 return qMakePair(controller, context);
55 template<
typename Controller,
typename Context,
typename ... Args>
56 static QSharedPointer<WorkflowRequest>
create(Args&& ... pArgs)
58 auto [controller, context] = getGenerator<Controller, Context, Args...>(std::forward<Args>(pArgs) ...);
59 return QSharedPointer<WorkflowRequest>::create(controller, context);
63 template<
typename Controller,
typename Context,
typename ... Args>
64 static QSharedPointer<WorkflowRequest>
createHandler(
const BusyHandler& pBusyHandler, Args&& ... pArgs)
66 return createHandler<Controller, Context, Args...>(pBusyHandler, QVariant(), std::forward<Args>(pArgs) ...);
70 template<
typename Controller,
typename Context,
typename ... Args>
71 static QSharedPointer<WorkflowRequest>
createHandler(
const BusyHandler& pBusyHandler,
const QVariant& pData, Args&& ... pArgs)
73 auto [controller, context] = getGenerator<Controller, Context, Args...>(std::forward<Args>(pArgs) ...);
74 return QSharedPointer<WorkflowRequest>::create(controller, context, pBusyHandler, pData);
78 WorkflowRequest(
const std::function<QSharedPointer<WorkflowController>(
const QSharedPointer<WorkflowContext>& pContext)>& pGeneratorController,
79 const std::function<QSharedPointer<WorkflowContext>()>& pGeneratorContext,
80 const BusyHandler& pHandler = BusyHandler(),
81 const QVariant& pData = QVariant());
86 [[nodiscard]] QSharedPointer<WorkflowController>
getController()
const;
87 [[nodiscard]] QSharedPointer<WorkflowContext>
getContext()
const;
88 [[nodiscard]] QVariant
getData()
const;
89 [[nodiscard]] WorkflowControl
handleBusyWorkflow(
const QSharedPointer<WorkflowRequest>& pActiveWorkflow,
const QSharedPointer<WorkflowRequest>& pWaitingWorkflow)
const;
#define defineEnumType(enumName,...)
Definition EnumHelper.h:85
Definition WorkflowController.h:24
Definition WorkflowRequest.h:26
Action getAction() const
Definition WorkflowRequest.cpp:45
void initialize()
Definition WorkflowRequest.cpp:30
static QSharedPointer< WorkflowRequest > createHandler(const BusyHandler &pBusyHandler, const QVariant &pData, Args &&... pArgs)
Definition WorkflowRequest.h:71
QSharedPointer< WorkflowContext > getContext() const
Definition WorkflowRequest.cpp:57
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:51
static QSharedPointer< WorkflowRequest > createHandler(const BusyHandler &pBusyHandler, Args &&... pArgs)
Definition WorkflowRequest.h:64
static QSharedPointer< WorkflowRequest > create(Args &&... pArgs)
Definition WorkflowRequest.h:56
QVariant getData() const
Definition WorkflowRequest.cpp:63
bool isInitialized() const
Definition WorkflowRequest.cpp:39
WorkflowControl handleBusyWorkflow(const QSharedPointer< WorkflowRequest > &pActiveWorkflow, const QSharedPointer< WorkflowRequest > &pWaitingWorkflow) const
Definition WorkflowRequest.cpp:69
Implementation of GeneralAuthenticate response APDUs.
Definition CommandApdu.h:17