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 <map> | ||
9 | #include <cstdint> | ||
10 | #include <limits> | ||
11 | #include "Intervals.h" | ||
12 | |||
13 | namespace imgdoc2 | ||
14 | { | ||
15 | /// This interface is used for retrieving information about the document. | ||
16 | class IDocInfo | ||
17 | { | ||
18 | public: | ||
19 | 296 | virtual ~IDocInfo() = default; | |
20 | |||
21 | /// Gets the tile dimensions used in the document. | ||
22 | /// | ||
23 | /// \param dimensions If non-null, the dimensions are put into the array pointed to. | ||
24 | /// \param count On input, the size of the array 'dimension' (number of elements). On output, the number of tile dimensions available. | ||
25 | virtual void GetTileDimensions(imgdoc2::Dimension* dimensions, std::uint32_t& count) = 0; | ||
26 | |||
27 | /// Gets minimum and maximum value for specified tile dimension. | ||
28 | /// If the minimum/maximum cannot be determined (for a dimension), then the result will be | ||
29 | /// one where Minimum is greater than Maximum (=an invalid Int32Interval). This can happen | ||
30 | /// e.g. if the document is empty, or the coordinates are Null. | ||
31 | /// | ||
32 | /// \param dimensions_to_query_for Vector containing the dimensions to be queried for. | ||
33 | /// | ||
34 | /// \returns A map containing the min/max-information for the requested dimensions. | ||
35 | virtual std::map<imgdoc2::Dimension, imgdoc2::Int32Interval> GetMinMaxForTileDimension(const std::vector<imgdoc2::Dimension>& dimensions_to_query_for) = 0; | ||
36 | |||
37 | /// Gets the total number of tiles (or bricks) in the document. | ||
38 | /// | ||
39 | /// \returns The total tile count. | ||
40 | virtual std::uint64_t GetTotalTileCount() = 0; | ||
41 | |||
42 | /// Gets the total number of tiles (or bricks) per pyramid layer. | ||
43 | /// | ||
44 | /// \returns A map, where key is the pyramid layer number, and value is the total number of tiles (on this layer) in the document. | ||
45 | virtual std::map<int, std::uint64_t> GetTileCountPerLayer() = 0; | ||
46 | public: | ||
47 | 6 | std::vector<imgdoc2::Dimension> GetTileDimensions() | |
48 | { | ||
49 | 6 | std::uint32_t count = 0; | |
50 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
6 | this->GetTileDimensions(nullptr, count); |
51 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
6 | std::vector<imgdoc2::Dimension> dimensions(count); |
52 |
1/2✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | this->GetTileDimensions(dimensions.data(), count); |
53 | 12 | return dimensions; | |
54 | ✗ | } | |
55 | |||
56 | // no copy and no move (-> https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c21-if-you-define-or-delete-any-copy-move-or-destructor-function-define-or-delete-them-all ) | ||
57 | 148 | IDocInfo() = default; | |
58 | IDocInfo(const IDocInfo&) = delete; // copy constructor | ||
59 | IDocInfo& operator=(const IDocInfo&) = delete; // copy assignment | ||
60 | IDocInfo(IDocInfo&&) = delete; // move constructor | ||
61 | IDocInfo& operator=(IDocInfo&&) = delete; // move assignment | ||
62 | }; | ||
63 | } | ||
64 |