PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
send_network_io_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
17#pragma once
18
22
23#include <cstdint>
24#include <functional>
25#include <string>
26#include <vector>
27
29
43public:
45 using completion_callback = std::function<void(uint64_t session_id,
46 bool success,
47 size_t bytes_sent)>;
48
50 using error_callback = std::function<void(uint64_t session_id,
51 const std::string& error)>;
52
54 using send_function = std::function<VoidResult(uint64_t session_id,
55 const std::vector<uint8_t>& data)>;
56
66 send_network_io_job(uint64_t session_id,
67 std::vector<uint8_t> data,
68 send_function send_fn,
69 completion_callback on_complete = nullptr,
70 error_callback on_error = nullptr);
71
72 ~send_network_io_job() override = default;
73
74 // Non-copyable, movable
79
88 [[nodiscard]] auto execute(pipeline_coordinator& coordinator) -> VoidResult override;
89
93 [[nodiscard]] auto get_context() const noexcept -> const job_context& override;
94 [[nodiscard]] auto get_context() noexcept -> job_context& override;
95
99 [[nodiscard]] auto get_name() const -> std::string override;
100
104 [[nodiscard]] auto get_data() const noexcept -> const std::vector<uint8_t>&;
105
109 [[nodiscard]] auto get_session_id() const noexcept -> uint64_t;
110
111private:
113 std::vector<uint8_t> data_;
117};
118
119} // namespace kcenon::pacs::network::pipeline
Coordinates the 6-stage DICOM I/O pipeline.
Job for sending PDU data over network connections.
send_network_io_job & operator=(send_network_io_job &&)=default
send_network_io_job(const send_network_io_job &)=delete
send_network_io_job(uint64_t session_id, std::vector< uint8_t > data, send_function send_fn, completion_callback on_complete=nullptr, error_callback on_error=nullptr)
Construct a send job.
auto get_data() const noexcept -> const std::vector< uint8_t > &
Get the data to send.
std::function< void(uint64_t session_id, bool success, size_t bytes_sent)> completion_callback
Callback type for send completion.
auto get_name() const -> std::string override
Get the job name.
auto execute(pipeline_coordinator &coordinator) -> VoidResult override
Execute the send job.
std::function< void(uint64_t session_id, const std::string &error)> error_callback
Callback type for send errors.
std::function< VoidResult(uint64_t session_id, const std::vector< uint8_t > &data)> send_function
Function type for actual network send operation.
auto get_session_id() const noexcept -> uint64_t
Get the session ID.
auto get_context() const noexcept -> const job_context &override
Get the job context.
send_network_io_job(send_network_io_job &&)=default
send_network_io_job & operator=(const send_network_io_job &)=delete
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.
Context information attached to pipeline jobs for tracking.