PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
response_encode_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 <vector>
28
30
37 uint64_t session_id;
38
40 std::vector<uint8_t> pdu_data;
41
43 bool is_final{true};
44
46 uint16_t message_id;
47};
48
63public:
65 using encode_callback = std::function<void(const encoded_response& response)>;
66
68 using error_callback = std::function<void(uint64_t session_id,
69 const std::string& error)>;
70
80 uint32_t max_pdu_size = 16384,
81 encode_callback on_encoded = nullptr,
82 error_callback on_error = nullptr);
83
84 ~response_encode_job() override = default;
85
86 // Non-copyable, movable
91
100 [[nodiscard]] auto execute(pipeline_coordinator& coordinator) -> VoidResult override;
101
105 [[nodiscard]] auto get_context() const noexcept -> const job_context& override;
106 [[nodiscard]] auto get_context() noexcept -> job_context& override;
107
111 [[nodiscard]] auto get_name() const -> std::string override;
112
116 [[nodiscard]] auto get_result() const noexcept -> const service_result&;
117
118private:
124
126 [[nodiscard]] auto encode_response() -> Result<std::vector<encoded_response>>;
127
129 [[nodiscard]] auto encode_dimse_command() -> Result<std::vector<uint8_t>>;
130
132 [[nodiscard]] auto fragment_data(const std::vector<uint8_t>& data)
133 -> std::vector<std::vector<uint8_t>>;
134};
135
136} // namespace kcenon::pacs::network::pipeline
Coordinates the 6-stage DICOM I/O pipeline.
Job for encoding DIMSE responses into PDU bytes.
std::function< void(const encoded_response &response)> encode_callback
Callback type for encoded response.
response_encode_job(const response_encode_job &)=delete
response_encode_job & operator=(response_encode_job &&)=default
response_encode_job(response_encode_job &&)=default
response_encode_job(service_result result, uint32_t max_pdu_size=16384, encode_callback on_encoded=nullptr, error_callback on_error=nullptr)
Construct an encode job.
auto fragment_data(const std::vector< uint8_t > &data) -> std::vector< std::vector< uint8_t > >
Fragment large data if needed.
auto get_result() const noexcept -> const service_result &
Get the service result.
auto get_name() const -> std::string override
Get the job name.
auto get_context() const noexcept -> const job_context &override
Get the job context.
response_encode_job & operator=(const response_encode_job &)=delete
auto execute(pipeline_coordinator &coordinator) -> VoidResult override
Execute the encode job.
auto encode_response() -> Result< std::vector< encoded_response > >
Encode the response into PDU bytes.
std::function< void(uint64_t session_id, const std::string &error)> error_callback
Callback type for encoding errors.
auto encode_dimse_command() -> Result< std::vector< uint8_t > >
Encode DIMSE command.
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.
Storage and query execution job for Stage 4 of the pipeline.
Encoded PDU ready for network transmission.
uint16_t message_id
Original message ID for correlation.
std::vector< uint8_t > pdu_data
Encoded PDU bytes.
bool is_final
Whether this is the last response in a sequence.
Context information attached to pipeline jobs for tracking.