PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
storage_commitment_types.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
18#ifndef PACS_SERVICES_STORAGE_COMMITMENT_TYPES_HPP
19#define PACS_SERVICES_STORAGE_COMMITMENT_TYPES_HPP
20
21#include <chrono>
22#include <cstdint>
23#include <string>
24#include <string_view>
25#include <utility>
26#include <vector>
27
28namespace kcenon::pacs::services {
29
30// =============================================================================
31// Storage Commitment SOP Class UIDs
32// =============================================================================
33
35inline constexpr std::string_view storage_commitment_push_model_sop_class_uid =
36 "1.2.840.10008.1.20.1";
37
39inline constexpr std::string_view storage_commitment_push_model_sop_instance_uid =
40 "1.2.840.10008.1.20.1.1";
41
42// =============================================================================
43// Action and Event Type IDs
44// =============================================================================
45
47inline constexpr uint16_t storage_commitment_action_type_request = 1;
48
50inline constexpr uint16_t storage_commitment_event_type_success = 1;
51
53inline constexpr uint16_t storage_commitment_event_type_failure = 2;
54
55// =============================================================================
56// SOP Reference
57// =============================================================================
58
66 std::string sop_class_uid;
67 std::string sop_instance_uid;
68};
69
70// =============================================================================
71// Commitment Failure Reasons
72// =============================================================================
73
81enum class commitment_failure_reason : uint16_t {
83 processing_failure = 0x0110,
84
87
89 resource_limitation = 0x0213,
90
93
96
99};
100
106[[nodiscard]] inline std::string_view
108 switch (reason) {
110 return "Processing failure";
112 return "No such object instance";
114 return "Resource limitation";
116 return "Referenced SOP Class not supported";
118 return "Class/Instance conflict";
120 return "Duplicate Transaction UID";
121 }
122 return "Unknown failure reason";
123}
124
125// =============================================================================
126// Commitment Result
127// =============================================================================
128
137 std::string transaction_uid;
138
140 std::vector<sop_reference> success_references;
141
143 std::vector<std::pair<sop_reference, commitment_failure_reason>> failed_references;
144
146 std::chrono::system_clock::time_point timestamp;
147
149 [[nodiscard]] bool all_successful() const noexcept {
150 return failed_references.empty() && !success_references.empty();
151 }
152
154 [[nodiscard]] std::size_t total_instances() const noexcept {
155 return success_references.size() + failed_references.size();
156 }
157};
158
159} // namespace kcenon::pacs::services
160
161#endif // PACS_SERVICES_STORAGE_COMMITMENT_TYPES_HPP
constexpr std::string_view storage_commitment_push_model_sop_instance_uid
Storage Commitment Push Model SOP Instance UID (Well-Known)
constexpr uint16_t storage_commitment_event_type_success
N-EVENT-REPORT: Storage Commitment Request Successful (Event Type ID = 1)
constexpr std::string_view storage_commitment_push_model_sop_class_uid
Storage Commitment Push Model SOP Class UID (PS3.4 Table J.3-1)
commitment_failure_reason
Failure reason codes for Storage Commitment.
@ referenced_sop_class_not_supported
Referenced SOP Class not supported by SCP.
@ duplicate_transaction_uid
Duplicate Transaction UID.
@ no_such_object_instance
Referenced SOP Instance not found in storage.
@ processing_failure
General processing failure.
@ class_instance_conflict
SOP Class / Instance UID mismatch.
@ resource_limitation
Storage resource limitation (e.g., disk full)
constexpr uint16_t storage_commitment_event_type_failure
N-EVENT-REPORT: Storage Commitment Request Complete - Failures Exist (Event Type ID = 2)
constexpr uint16_t storage_commitment_action_type_request
N-ACTION: Request Storage Commitment (Action Type ID = 1)
auto to_string(mpps_status status) -> std::string_view
Convert mpps_status to DICOM string representation.
Definition mpps_scp.h:60
Result of a Storage Commitment verification.
std::chrono::system_clock::time_point timestamp
Timestamp when verification was completed.
std::vector< std::pair< sop_reference, commitment_failure_reason > > failed_references
Failed SOP Instance references with failure reasons.
std::vector< sop_reference > success_references
Successfully committed SOP Instance references.
std::string transaction_uid
Transaction UID identifying this commitment request.
bool all_successful() const noexcept
Whether all instances were successfully committed.
std::size_t total_instances() const noexcept
Total number of instances in this result.
Reference to a SOP Instance in a commitment request.
std::string sop_class_uid
Referenced SOP Class UID (0008,1150)
std::string sop_instance_uid
Referenced SOP Instance UID (0008,1155)