GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/Validator.h
Date: 2025-01-05 09:03:17
Exec Total Coverage
Lines: 5 8 62.5%
Functions: 2 6 33.3%
Branches: 1 4 25.0%

Line Branch Exec Source
1 #pragma once
2
3 #include <mutex>
4 #include <optional>
5
6 #include <hipo4/bank.h>
7
8 #include "iguana/algorithms/Algorithm.h"
9 #include "iguana/algorithms/AlgorithmSequence.h"
10
11 namespace iguana {
12
13 /// @brief Base class for all algorithm validators to inherit from
14 ///
15 /// Similar to `iguana::Algorithm`, derived classes should override the methods
16 /// `Validator::Start`, `Validator::Run` and `Validator::Stop`
17 class Validator : public Algorithm
18 {
19
20 public:
21
22 /// @param name the unique name for a derived class instance
23 8 Validator(std::string_view name = "validator")
24 8 : Algorithm(name)
25
1/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
8 , m_output_dir("")
26 8 {}
27 16 virtual ~Validator() {}
28
29 void Start(hipo::banklist& banks) override{};
30 void Run(hipo::banklist& banks) const override{};
31 void Stop() override{};
32
33 /// Set this validator's output directory
34 /// @param output_dir the output directory
35 void SetOutputDirectory(std::string_view output_dir);
36
37 /// Get this validator's output directory
38 /// @returns an `optional`, which is set if the output directory is defined
39 std::optional<std::string> GetOutputDirectory();
40
41 protected:
42
43 /// An `iguana::AlgorithmSequence` to be used for this validator
44 std::unique_ptr<AlgorithmSequence> m_algo_seq;
45
46 /// Mutex for locking procedures such as histogram filling in `Validator::Run`
47 mutable std::mutex m_mutex;
48
49 private:
50
51 /// output directory
52 std::string m_output_dir;
53 };
54 }
55