PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
pdu_decode_job.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#pragma once
19
24
25#include <cstdint>
26#include <functional>
27#include <string>
28#include <vector>
29
31
39
41 uint64_t session_id;
42
44 std::vector<uint8_t> data;
45
48
50 bool is_last_fragment{true};
51};
52
67public:
69 using decode_callback = std::function<void(const decoded_pdu& pdu)>;
70
72 using error_callback = std::function<void(uint64_t session_id,
73 const std::string& error)>;
74
83 pdu_decode_job(uint64_t session_id,
84 std::vector<uint8_t> raw_data,
85 decode_callback on_decoded = nullptr,
86 error_callback on_error = nullptr);
87
88 ~pdu_decode_job() override = default;
89
90 // Non-copyable, movable
95
104 [[nodiscard]] auto execute(pipeline_coordinator& coordinator) -> VoidResult override;
105
109 [[nodiscard]] auto get_context() const noexcept -> const job_context& override;
110 [[nodiscard]] auto get_context() noexcept -> job_context& override;
111
115 [[nodiscard]] auto get_name() const -> std::string override;
116
120 [[nodiscard]] auto get_raw_data() const noexcept -> const std::vector<uint8_t>&;
121
122private:
124 std::vector<uint8_t> raw_data_;
127
129 [[nodiscard]] auto decode_pdu() -> Result<decoded_pdu>;
130};
131
132} // namespace kcenon::pacs::network::pipeline
pdu_decode_job & operator=(const pdu_decode_job &)=delete
std::function< void(const decoded_pdu &pdu)> decode_callback
Callback type for decoded PDU.
auto get_name() const -> std::string override
Get the job name.
auto get_raw_data() const noexcept -> const std::vector< uint8_t > &
Get the raw PDU data.
pdu_decode_job(const pdu_decode_job &)=delete
auto decode_pdu() -> Result< decoded_pdu >
Internal decode method.
pdu_decode_job & operator=(pdu_decode_job &&)=default
auto execute(pipeline_coordinator &coordinator) -> VoidResult override
Execute the decode job.
pdu_decode_job(uint64_t session_id, std::vector< uint8_t > raw_data, decode_callback on_decoded=nullptr, error_callback on_error=nullptr)
Construct a decode job.
std::function< void(uint64_t session_id, const std::string &error)> error_callback
Callback type for decode errors.
auto get_context() const noexcept -> const job_context &override
Get the job context.
Coordinates the 6-stage DICOM I/O pipeline.
pdu_type
PDU (Protocol Data Unit) types as defined in DICOM PS3.8.
Definition pdu_types.h:25
std::variant< associate_rq, associate_ac, associate_rj, p_data_tf_pdu, release_rq_pdu, release_rp_pdu, abort_pdu > pdu
Variant type that can hold any PDU.
Definition pdu_decoder.h:62
kcenon::pacs::VoidResult VoidResult
VoidResult type alias for operations without return value.
Definition association.h:59
Main coordinator for the 6-stage DICOM I/O pipeline.
Job type definitions for the 6-stage DICOM I/O pipeline.
Result<T> type aliases and helpers for PACS system.
Result of PDU decoding containing the PDU type and data.
uint64_t session_id
Session this PDU belongs to.
std::vector< uint8_t > data
Raw PDU data for further processing.
kcenon::pacs::network::pdu_type type
The type of PDU that was decoded.
bool is_last_fragment
Whether this is the last fragment (for P-DATA-TF)
uint8_t presentation_context_id
Presentation context ID (for P-DATA-TF)
Context information attached to pipeline jobs for tracking.