GCC Code Coverage Report


Directory: libimgdoc2/
File: libimgdoc2/inc/DimCoordinateQueryClause.h
Date: 2025-02-03 12:41:04
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 3 3 100.0%
Branches: 3 4 75.0%

Line Branch Exec Source
1 // SPDX-FileCopyrightText: 2023 Carl Zeiss Microscopy GmbH
2 //
3 // SPDX-License-Identifier: MIT
4
5 #pragma once
6
7 #include "IDimCoordinateQueryClause.h"
8 #include <vector>
9 #include <map>
10 #include <set>
11
12 namespace imgdoc2
13 {
14 /// A simple implementation of the IDimCoordinateQueryClause interface.
15 class CDimCoordinateQueryClause : public IDimCoordinateQueryClause
16 {
17 private:
18 std::map<imgdoc2::Dimension, std::vector<RangeClause>> rangeClauses;
19 std::set<imgdoc2::Dimension> dims;
20 public:
21 /// Adds a range clause for the specified dimension.
22 /// \param d The dimension.
23 /// \param clause The clause.
24 46 void AddRangeClause(imgdoc2::Dimension d, const RangeClause& clause)
25 {
26 46 this->rangeClauses[d].push_back(clause);
27 46 this->dims.insert(d);
28 46 }
29
30 //! @copydoc imgdoc2::IDimCoordinateQueryClause::GetTileDimsForClause() const
31 44 const std::set<imgdoc2::Dimension>& GetTileDimsForClause() const override
32 {
33 44 return this->dims;
34 }
35
36 //! @copydoc imgdoc2::IDimCoordinateQueryClause::GetRangeClause(imgdoc2::Dimension) const
37 40 const std::vector<RangeClause>* GetRangeClause(imgdoc2::Dimension d) const override
38 {
39
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 const auto& c = this->rangeClauses.find(d);
40
2/2
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 2 times.
40 if (c != this->rangeClauses.cend())
41 {
42 38 return &c->second;
43 }
44
45 2 return nullptr;
46 }
47 };
48 }
49