| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-FileCopyrightText: 2023 Carl Zeiss Microscopy GmbH | ||
| 2 | // | ||
| 3 | // SPDX-License-Identifier: MIT | ||
| 4 | |||
| 5 | #include <imgdoc2.h> | ||
| 6 | #include <string> | ||
| 7 | #include <unordered_set> | ||
| 8 | #include <sstream> | ||
| 9 | |||
| 10 | using namespace std; | ||
| 11 | using namespace imgdoc2; | ||
| 12 | |||
| 13 | class CreateOptions : public imgdoc2::ICreateOptions | ||
| 14 | { | ||
| 15 | private: | ||
| 16 | imgdoc2::DocumentType document_type_ = imgdoc2::DocumentType::kImage2d; | ||
| 17 | std::string filename_; | ||
| 18 | std::unordered_set<Dimension> dimensions_; | ||
| 19 | std::unordered_set<Dimension> dimensionsToIndex_; | ||
| 20 | bool use_spatial_index_ = false; | ||
| 21 | bool create_blob_table_ = false; | ||
| 22 | public: | ||
| 23 | 258 | CreateOptions() = default; | |
| 24 | |||
| 25 | 74 | void SetDocumentType(imgdoc2::DocumentType document_type) override | |
| 26 | { | ||
| 27 | 74 | this->document_type_ = document_type; | |
| 28 | 74 | } | |
| 29 | |||
| 30 | 506 | [[nodiscard]] imgdoc2::DocumentType GetDocumentType() const override | |
| 31 | { | ||
| 32 | 506 | return this->document_type_; | |
| 33 | } | ||
| 34 | |||
| 35 | 248 | void SetFilename(const char* filename) override | |
| 36 | { | ||
| 37 | 248 | this->filename_ = filename; | |
| 38 | 248 | } | |
| 39 | |||
| 40 | 248 | [[nodiscard]] const std::string& GetFilename() const override | |
| 41 | { | ||
| 42 | 248 | return this->filename_; | |
| 43 | } | ||
| 44 | |||
| 45 | 144 | void SetUseSpatialIndex(bool use_spatial_index) override | |
| 46 | { | ||
| 47 | 144 | this->use_spatial_index_ = use_spatial_index; | |
| 48 | 144 | } | |
| 49 | |||
| 50 | 146 | void SetCreateBlobTable(bool create_blob_table) override | |
| 51 | { | ||
| 52 | 146 | this->create_blob_table_ = create_blob_table; | |
| 53 | 146 | } | |
| 54 | |||
| 55 | 516 | [[nodiscard]] bool GetUseSpatialIndex() const override | |
| 56 | { | ||
| 57 | 516 | return this->use_spatial_index_; | |
| 58 | } | ||
| 59 | |||
| 60 | 312 | void AddDimension(Dimension dim) override | |
| 61 | { | ||
| 62 | 312 | ThrowIfDimensionInvalid(dim); | |
| 63 | 312 | this->dimensions_.emplace(dim); | |
| 64 | 312 | } | |
| 65 | |||
| 66 | 20 | void AddIndexForDimension(Dimension dim) override | |
| 67 | { | ||
| 68 | 20 | ThrowIfDimensionInvalid(dim); | |
| 69 | 20 | this->dimensionsToIndex_.emplace(dim); | |
| 70 | 20 | } | |
| 71 | |||
| 72 | 516 | [[nodiscard]] const std::unordered_set<Dimension>& GetDimensions() const override | |
| 73 | { | ||
| 74 | 516 | return this->dimensions_; | |
| 75 | } | ||
| 76 | |||
| 77 | 516 | [[nodiscard]] const std::unordered_set<imgdoc2::Dimension>& GetIndexedDimensions() const override | |
| 78 | { | ||
| 79 | 516 | return this->dimensionsToIndex_; | |
| 80 | } | ||
| 81 | |||
| 82 | 516 | [[nodiscard]] bool GetCreateBlobTable() const override | |
| 83 | { | ||
| 84 | 516 | return this->create_blob_table_; | |
| 85 | } | ||
| 86 | }; | ||
| 87 | |||
| 88 | ✗ | /*static*/ICreateOptions* imgdoc2::ClassFactory::CreateCreateOptionsPtr() | |
| 89 | { | ||
| 90 | ✗ | return new CreateOptions(); | |
| 91 | } | ||
| 92 | |||
| 93 | 256 | /*static*/std::unique_ptr<imgdoc2::ICreateOptions> imgdoc2::ClassFactory::CreateCreateOptionsUp() | |
| 94 | { | ||
| 95 |
1/2✓ Branch 1 taken 256 times.
✗ Branch 2 not taken.
|
256 | return make_unique<CreateOptions>(); |
| 96 | } | ||
| 97 | |||
| 98 | 2 | /*static*/std::shared_ptr<imgdoc2::ICreateOptions> imgdoc2::ClassFactory::CreateCreateOptionsSp() | |
| 99 | { | ||
| 100 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | return make_shared<CreateOptions>(); |
| 101 | } | ||
| 102 |