LCOV - code coverage report
Current view: top level - src - simpletransaction.h Coverage Total Hit
Test: .lcov.total Lines: 100.0 % 2 2
Test Date: 2026-03-23 21:55:57 Functions: - 0 0

            Line data    Source code
       1              : // SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
       2              : // SPDX-License-Identifier: GPL-3.0-or-later
       3              : #ifndef SRC_SIMPLETRANSACTION_H_
       4              : #define SRC_SIMPLETRANSACTION_H_
       5              : 
       6              : #include "enums.h"
       7              : #include <queue>
       8              : 
       9           23 : class simpleTransaction {
      10              :   int transactionDepth;
      11              :   Enums::PROCESS lastInTransaction;
      12              :   std::queue<std::pair<Enums::PROCESS, Enums::PROCESS>> transactionQueue;
      13              : 
      14              : public:
      15              :   simpleTransaction()
      16           23 :       : transactionDepth(0), lastInTransaction(Enums::INVALID) {}
      17              :   /**
      18              :    * @brief transactionStart this function is used to mark start of the sequence
      19              :    *                         of processes that shall be treated as one
      20              :    * operation.
      21              :    */
      22              :   void transactionStart();
      23              :   /**
      24              :    * @brief transactionAdd If called after call to transactionStart() and before
      25              :    *                       transactionEnd(), this method marks given process as
      26              :    *                       next step in transaction. Otherwise it marks given
      27              :    *                       process as the only step in transaction(it's value is
      28              :    *                       treated as transaction result).
      29              :    *
      30              :    * @param id process that shall be treated as part of transaction
      31              :    */
      32              :   void transactionAdd(Enums::PROCESS);
      33              :   /**
      34              :    * @brief transactionEnd marks end of transaction
      35              :    *
      36              :    * @param pid value that will be used as a result of transaction
      37              :    */
      38              :   void transactionEnd(Enums::PROCESS);
      39              :   /**
      40              :    * @brief transactionIsOver checks wheather currently finished process is last
      41              :    *                          in current transaction
      42              :    *
      43              :    * @return result of transaction as set by transactionAdd or transactionEnd if
      44              :    *         the transaction is over or PROCESS::INVALID if it's not yet over
      45              :    */
      46              :   auto transactionIsOver(Enums::PROCESS) -> Enums::PROCESS;
      47              : };
      48              : 
      49              : #endif // SRC_SIMPLETRANSACTION_H_
        

Generated by: LCOV version 2.4-beta