| 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 <vector> | ||
| 8 | #include <tuple> | ||
| 9 | #include "ITIleInfoQueryClause.h" | ||
| 10 | |||
| 11 | using namespace std; | ||
| 12 | |||
| 13 | namespace imgdoc2 | ||
| 14 | { | ||
| 15 | /// A simplistic implementation of the ITileInfoQueryClause interface. | ||
| 16 | class CTileInfoQueryClause : public imgdoc2::ITileInfoQueryClause | ||
| 17 | { | ||
| 18 | private: | ||
| 19 | std::vector<std::tuple< LogicalOperator, ComparisonOperation, int>> pyramid_level_conditionals; | ||
| 20 | public: | ||
| 21 | /// Default constructor. | ||
| 22 | 16 | CTileInfoQueryClause() = default; | |
| 23 | |||
| 24 | //! @copydoc imgdoc2::ITileInfoQueryClause::GetPyramidLevelCondition(int,LogicalOperator*,ComparisonOperation*,int*) const | ||
| 25 | 32 | bool GetPyramidLevelCondition(int no, LogicalOperator* logical_operator, ComparisonOperation* comparison_operation, int* value) const override | |
| 26 | { | ||
| 27 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 2 taken 16 times.
|
32 | if (no >= this->pyramid_level_conditionals.size()) |
| 28 | { | ||
| 29 | 16 | return false; | |
| 30 | } | ||
| 31 | |||
| 32 | 16 | const auto& element = this->pyramid_level_conditionals.at(no); | |
| 33 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (logical_operator != nullptr) |
| 34 | { | ||
| 35 | 16 | *logical_operator = get<0>(element); | |
| 36 | } | ||
| 37 | |||
| 38 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (comparison_operation != nullptr) |
| 39 | { | ||
| 40 | 16 | *comparison_operation = get<1>(element); | |
| 41 | } | ||
| 42 | |||
| 43 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (value != nullptr) |
| 44 | { | ||
| 45 | 16 | *value = get<2>(element); | |
| 46 | } | ||
| 47 | |||
| 48 | 16 | return true; | |
| 49 | } | ||
| 50 | |||
| 51 | /// Adds a condition for the pyramid level. This condition is added to the end of the internal list of conditions. | ||
| 52 | /// \param logical_operator The logical operator. | ||
| 53 | /// \param comparison_operation The comparison operation. | ||
| 54 | /// \param value The value. | ||
| 55 | 16 | void AddPyramidLevelCondition(LogicalOperator logical_operator, ComparisonOperation comparison_operation, int value) | |
| 56 | { | ||
| 57 |
2/4✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
|
16 | this->pyramid_level_conditionals.emplace_back(make_tuple(logical_operator, comparison_operation, value)); |
| 58 | 16 | } | |
| 59 | }; | ||
| 60 | } | ||
| 61 |