GCC Code Coverage Report


Directory: ./
File: include/na64calib/indices/yaml-index.hh
Date: 2025-09-01 06:19:01
Exec Total Coverage
Lines: 0 1 0.0%
Functions: 0 1 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /* This file is a part of NA64SW software.
2 * Copyright (C) 2015-2022 NA64 Collaboration, CERN
3 *
4 * NA64SW is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17 #pragma once
18
19 #include <yaml-cpp/yaml.h>
20
21 #include "na64calib/indices/range-override.hh"
22 #include "na64detID/TBName.hh"
23
24 namespace na64dp {
25 namespace calib {
26
27 /**\brief A calibration data index provided within the YAML file
28 *
29 * Expected input node is an array of objects. Each object shall define
30 * at least following fields:
31 * * "dataType" : type name (alias), string
32 * * "validity": pair of runs (from, to)
33 * * "loader": name of loader
34 * Rest nodes will be forwarded to an update body (update subtype is of
35 * `RangeOverrideRunIndex<T, YAML::Node>` where `T` is `EventID` or `time_t`).
36 *
37 * This object is designed to handle updates with following features:
38 * - from documents that are not self-annotated (loaders "yaml-doc" or
39 * "csv-doc")
40 * - small datum defined entirely within this node
41 * */
42 class YAMLIndex : public RangeOverrideRunIndex<EventID, YAML::Node>
43 , public RangeOverrideRunIndex< std::pair<time_t, uint32_t>
44 , YAML::Node
45 >
46 {
47 public:
48 /// Creates empty index
49 YAMLIndex() : iIndex() {}
50 virtual ~YAMLIndex(){}
51 /// Creates index from the node provided
52 void add_records( const YAML::Node & entries
53 , const std::unordered_map<std::string, Dispatcher::CIDataID> & aliases
54 , const std::unordered_map<std::string, std::shared_ptr<iLoader>> & loadersByName
55 );
56 /// Collects calibration information differences between two runs
57 void append_updates( EventID oldEventID, EventID newEventID
58 , const std::pair<time_t, uint32_t> & oldDatetime
59 , const std::pair<time_t, uint32_t> & newDateTime
60 , Updates & ) override;
61 /// Shall dump index content for inspection
62 void to_yaml(YAML::Node &) const override;
63 };
64
65 } // namespace ::na64dp::calib
66 } // namespace na64dp
67
68