QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
simpletransaction.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2017 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
8#include "simpletransaction.h"
9#include <utility>
10
11#include "qtpasslogging.h"
12
13using Enums::INVALID;
14using Enums::PROCESS;
15
17 qCDebug(lcQtPass) << "START" << transactionDepth;
19}
20
22 qCDebug(lcQtPass) << "ADD" << transactionDepth << id;
23 if (transactionDepth > 0) {
25 } else {
26 transactionQueue.emplace(id, id);
27 }
28}
29
31 qCDebug(lcQtPass) << "END" << transactionDepth;
32 if (transactionDepth > 0) {
37 }
38 }
39}
40
42 qCDebug(lcQtPass) << "OVER" << transactionDepth << id;
43 if (!transactionQueue.empty() && id == transactionQueue.front().first) {
44 PROCESS ret = transactionQueue.front().second;
45 transactionQueue.pop();
46 return ret;
47 }
48 return INVALID;
49}
void transactionAdd(Enums::PROCESS process)
Note that process has been queued.
auto transactionIsOver(Enums::PROCESS current) -> Enums::PROCESS
Tell whether the process that just finished ends the oldest pending transaction, and take that transa...
void transactionStart()
Open a transaction: the processes added until the matching transactionEnd() are reported as one opera...
void transactionEnd(Enums::PROCESS process)
Close the transaction opened by the matching transactionStart().
int transactionDepth
How many transactionStart() calls are still open.
std::queue< std::pair< Enums::PROCESS, Enums::PROCESS > > transactionQueue
Closed transactions awaiting completion, oldest first: the process that ends each one,...
Enums::PROCESS lastInTransaction
The process most recently added to the open transaction, or Enums::INVALID when none was added yet.
@ INVALID
Definition enums.h:63
PROCESS
Identifies different subprocess operations used in QtPass.
Definition enums.h:43
@ INVALID
Definition enums.h:63
The "qtpass" logging category.
SimpleTransaction, the bookkeeping that lets ImitatePass report several queued processes as one finis...