PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
streaming_query_handler.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
22#pragma once
23
24#include "query_result_stream.h"
25
28
29#include <functional>
30#include <memory>
31#include <string>
32
33namespace kcenon::pacs::storage {
34class index_database;
35} // namespace kcenon::pacs::storage
36
37namespace kcenon::pacs::services {
38
39#ifdef PACS_WITH_DATABASE_SYSTEM
40
68class streaming_query_handler {
69public:
71 using StreamResult = Result<std::unique_ptr<query_result_stream>>;
72
78 explicit streaming_query_handler(storage::index_database* db);
79
83 ~streaming_query_handler() = default;
84
85 // Non-copyable
86 streaming_query_handler(const streaming_query_handler&) = delete;
87 auto operator=(const streaming_query_handler&) -> streaming_query_handler& = delete;
88
89 // Movable
90 streaming_query_handler(streaming_query_handler&&) noexcept = default;
91 auto operator=(streaming_query_handler&&) noexcept -> streaming_query_handler& = default;
92
93 // =========================================================================
94 // Configuration
95 // =========================================================================
96
102 void set_page_size(size_t size) noexcept;
103
109 [[nodiscard]] auto page_size() const noexcept -> size_t;
110
116 void set_max_results(size_t max) noexcept;
117
123 [[nodiscard]] auto max_results() const noexcept -> size_t;
124
125 // =========================================================================
126 // Stream Operations
127 // =========================================================================
128
139 [[nodiscard]] auto create_stream(query_level level,
140 const core::dicom_dataset& query_keys,
141 const std::string& calling_ae) -> StreamResult;
142
151 [[nodiscard]] auto resume_stream(const std::string& cursor_state, query_level level,
152 const core::dicom_dataset& query_keys) -> StreamResult;
153
154 // =========================================================================
155 // Compatibility Adapter
156 // =========================================================================
157
167 [[nodiscard]] auto as_query_handler() -> query_handler;
168
169private:
171 storage::index_database* db_;
172
174 size_t page_size_{100};
175
177 size_t max_results_{0};
178};
179
180#endif // PACS_WITH_DATABASE_SYSTEM
181
182} // namespace kcenon::pacs::services
DICOM Dataset - ordered collection of Data Elements.
Streaming query results with pagination support.
DICOM Query SCP service (C-FIND handler)