PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
repository_factory.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
20#pragma once
21
22#include <memory>
23
24#ifdef PACS_WITH_DATABASE_SYSTEM
25
26namespace kcenon::pacs::storage {
27
28// Forward declarations
29class pacs_database_adapter;
30class patient_repository;
31class study_repository;
32class series_repository;
33class instance_repository;
34class mpps_repository;
35class worklist_repository;
36class ups_repository;
37class audit_repository;
38class job_repository;
39class annotation_repository;
40class routing_repository;
41class node_repository;
42class sync_repository;
43class sync_config_repository;
44class sync_conflict_repository;
45class sync_history_repository;
46class key_image_repository;
47class measurement_repository;
48class viewer_state_repository;
49class viewer_state_record_repository;
50class recent_study_repository;
51class prefetch_repository;
52class prefetch_rule_repository;
53class prefetch_history_repository;
54class commitment_repository;
55
59struct sync_repository_set {
60 std::shared_ptr<sync_config_repository> configs;
61 std::shared_ptr<sync_conflict_repository> conflicts;
62 std::shared_ptr<sync_history_repository> history;
63};
64
68struct viewer_state_repository_set {
69 std::shared_ptr<viewer_state_record_repository> records;
70 std::shared_ptr<recent_study_repository> recent_studies;
71};
72
76struct prefetch_repository_set {
77 std::shared_ptr<prefetch_rule_repository> rules;
78 std::shared_ptr<prefetch_history_repository> history;
79};
80
88struct canonical_repository_set {
89 std::shared_ptr<patient_repository> patients;
90 std::shared_ptr<study_repository> studies;
91 std::shared_ptr<series_repository> series;
92 std::shared_ptr<instance_repository> instances;
93 std::shared_ptr<mpps_repository> mpps;
94 std::shared_ptr<worklist_repository> worklist;
95 std::shared_ptr<ups_repository> ups;
96 std::shared_ptr<audit_repository> audit;
97 std::shared_ptr<job_repository> jobs;
98 std::shared_ptr<annotation_repository> annotations;
99 std::shared_ptr<routing_repository> routing_rules;
100 std::shared_ptr<node_repository> nodes;
101 sync_repository_set sync;
102 std::shared_ptr<key_image_repository> key_images;
103 std::shared_ptr<measurement_repository> measurements;
104 viewer_state_repository_set viewer_state;
105 prefetch_repository_set prefetch;
106 std::shared_ptr<commitment_repository> commitments;
107};
108
115struct compatibility_repository_set {
116 std::shared_ptr<sync_repository> sync_states;
117 std::shared_ptr<viewer_state_repository> viewer_states;
118 std::shared_ptr<prefetch_repository> prefetch_queue;
119};
120
166class repository_factory {
167public:
173 explicit repository_factory(std::shared_ptr<pacs_database_adapter> db);
174
176 ~repository_factory() = default;
177
178 // Non-copyable
179 repository_factory(const repository_factory&) = delete;
180 auto operator=(const repository_factory&) -> repository_factory& = delete;
181
182 // Movable
183 repository_factory(repository_factory&&) noexcept = default;
184 auto operator=(repository_factory&&) noexcept
185 -> repository_factory& = default;
186
192 [[nodiscard]] auto patients() -> std::shared_ptr<patient_repository>;
193
199 [[nodiscard]] auto studies() -> std::shared_ptr<study_repository>;
200
206 [[nodiscard]] auto series() -> std::shared_ptr<series_repository>;
207
213 [[nodiscard]] auto instances() -> std::shared_ptr<instance_repository>;
214
220 [[nodiscard]] auto mpps() -> std::shared_ptr<mpps_repository>;
221
227 [[nodiscard]] auto worklist() -> std::shared_ptr<worklist_repository>;
228
234 [[nodiscard]] auto ups() -> std::shared_ptr<ups_repository>;
235
241 [[nodiscard]] auto audit() -> std::shared_ptr<audit_repository>;
242
251 [[nodiscard]] auto jobs() -> std::shared_ptr<job_repository>;
252
258 [[nodiscard]] auto annotations() -> std::shared_ptr<annotation_repository>;
259
265 [[nodiscard]] auto routing_rules() -> std::shared_ptr<routing_repository>;
266
272 [[nodiscard]] auto nodes() -> std::shared_ptr<node_repository>;
273
281 [[nodiscard]] auto sync_states() -> std::shared_ptr<sync_repository>;
282
286 [[nodiscard]] auto sync_configs()
287 -> std::shared_ptr<sync_config_repository>;
288
292 [[nodiscard]] auto sync_conflicts()
293 -> std::shared_ptr<sync_conflict_repository>;
294
298 [[nodiscard]] auto sync_history()
299 -> std::shared_ptr<sync_history_repository>;
300
306 [[nodiscard]] auto key_images() -> std::shared_ptr<key_image_repository>;
307
313 [[nodiscard]] auto measurements()
314 -> std::shared_ptr<measurement_repository>;
315
323 [[nodiscard]] auto viewer_states()
324 -> std::shared_ptr<viewer_state_repository>;
325
329 [[nodiscard]] auto viewer_state_records()
330 -> std::shared_ptr<viewer_state_record_repository>;
331
335 [[nodiscard]] auto recent_studies()
336 -> std::shared_ptr<recent_study_repository>;
337
345 [[nodiscard]] auto prefetch_queue()
346 -> std::shared_ptr<prefetch_repository>;
347
351 [[nodiscard]] auto prefetch_rules()
352 -> std::shared_ptr<prefetch_rule_repository>;
353
357 [[nodiscard]] auto prefetch_history()
358 -> std::shared_ptr<prefetch_history_repository>;
359
365 [[nodiscard]] auto commitments()
366 -> std::shared_ptr<commitment_repository>;
367
371 [[nodiscard]] auto canonical_repositories() -> canonical_repository_set;
372
376 [[nodiscard]] auto compatibility_repositories()
377 -> compatibility_repository_set;
378
384 [[nodiscard]] auto db() const -> std::shared_ptr<pacs_database_adapter>;
385
386private:
388 std::shared_ptr<pacs_database_adapter> db_;
389
391 std::shared_ptr<patient_repository> patients_;
392 std::shared_ptr<study_repository> studies_;
393 std::shared_ptr<series_repository> series_;
394 std::shared_ptr<instance_repository> instances_;
395 std::shared_ptr<mpps_repository> mpps_;
396 std::shared_ptr<worklist_repository> worklist_;
397 std::shared_ptr<ups_repository> ups_;
398 std::shared_ptr<audit_repository> audit_;
399 std::shared_ptr<job_repository> jobs_;
400 std::shared_ptr<annotation_repository> annotations_;
401 std::shared_ptr<routing_repository> routing_rules_;
402 std::shared_ptr<node_repository> nodes_;
403 std::shared_ptr<sync_repository> sync_states_;
404 std::shared_ptr<sync_config_repository> sync_configs_;
405 std::shared_ptr<sync_conflict_repository> sync_conflicts_;
406 std::shared_ptr<sync_history_repository> sync_history_;
407 std::shared_ptr<key_image_repository> key_images_;
408 std::shared_ptr<measurement_repository> measurements_;
409 std::shared_ptr<viewer_state_repository> viewer_states_;
410 std::shared_ptr<viewer_state_record_repository> viewer_state_records_;
411 std::shared_ptr<recent_study_repository> recent_studies_;
412 std::shared_ptr<prefetch_repository> prefetch_queue_;
413 std::shared_ptr<prefetch_rule_repository> prefetch_rules_;
414 std::shared_ptr<prefetch_history_repository> prefetch_history_;
415 std::shared_ptr<commitment_repository> commitments_;
416};
417
418} // namespace kcenon::pacs::storage
419
420#endif // PACS_WITH_DATABASE_SYSTEM
@ prefetch
Prefetch prior studies.
@ worklist
Modality Worklist Service Class.
@ ups
Unified Procedure Step Service Class.
@ mpps
Modality Performed Procedure Step.