PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::compat Namespace Reference

Typedefs

template<typename... Args>
using format_string = std::format_string<Args...>
 

Functions

template<typename T >
auto factory_result (kcenon::common::Result< T > result) -> kcenon::common::Result< T >
 
template<typename Pointer >
requires requires { typename Pointer::element_type; }
auto factory_result (Pointer pointer) -> kcenon::common::Result< Pointer >
 
std::tm * localtime_safe (const std::time_t *time, std::tm *result)
 Cross-platform thread-safe local time conversion.
 
std::tm * gmtime_safe (const std::time_t *time, std::tm *result)
 Cross-platform thread-safe UTC time conversion.
 

Typedef Documentation

◆ format_string

template<typename... Args>
using kcenon::pacs::compat::format_string = std::format_string<Args...>

Definition at line 33 of file format.h.

Function Documentation

◆ factory_result() [1/2]

template<typename T >
auto kcenon::pacs::compat::factory_result ( kcenon::common::Result< T > result) -> kcenon::common::Result<T>
nodiscard

Definition at line 16 of file factory_result.h.

17 {
18 return result;
19}

Referenced by kcenon::pacs::integration::network_adapter::connect(), and kcenon::pacs::network::v2::dicom_server_v2::start().

Here is the caller graph for this function:

◆ factory_result() [2/2]

template<typename Pointer >
requires requires { typename Pointer::element_type; }
auto kcenon::pacs::compat::factory_result ( Pointer pointer) -> kcenon::common::Result<Pointer>
nodiscard

Definition at line 23 of file factory_result.h.

24 {
25 if (!pointer) {
26 return kcenon::common::make_error<Pointer>(
27 kcenon::common::error::codes::common_errors::internal_error,
28 "Dependency factory returned null", "pacs");
29 }
30 return kcenon::common::Result<Pointer>(std::move(pointer));
31}

◆ gmtime_safe()

std::tm * kcenon::pacs::compat::gmtime_safe ( const std::time_t * time,
std::tm * result )
inline

Cross-platform thread-safe UTC time conversion.

Converts a time_t value to UTC time in a thread-safe manner. Uses gmtime_r on POSIX systems and gmtime_s on Windows.

Parameters
timePointer to the time_t value to convert
resultPointer to the tm structure to store the result
Returns
Pointer to the tm structure (result) on success, nullptr on failure

Definition at line 65 of file time.h.

65 {
66#if defined(_WIN32) || defined(_WIN64)
67 // Windows: gmtime_s returns errno_t (0 on success)
68 return gmtime_s(result, time) == 0 ? result : nullptr;
69#else
70 // POSIX: gmtime_r returns tm*
71 return gmtime_r(time, result);
72#endif
73}

Referenced by kcenon::pacs::storage::worklist_repository::cleanup_old_worklist_items().

Here is the caller graph for this function:

◆ localtime_safe()

std::tm * kcenon::pacs::compat::localtime_safe ( const std::time_t * time,
std::tm * result )
inline

Cross-platform thread-safe local time conversion.

Converts a time_t value to local time in a thread-safe manner. Uses localtime_r on POSIX systems and localtime_s on Windows.

Parameters
timePointer to the time_t value to convert
resultPointer to the tm structure to store the result
Returns
Pointer to the tm structure (result) on success, nullptr on failure

Definition at line 43 of file time.h.

43 {
44#if defined(_WIN32) || defined(_WIN64)
45 // Windows: localtime_s returns errno_t (0 on success)
46 // Parameter order: (tm*, time_t*)
47 return localtime_s(result, time) == 0 ? result : nullptr;
48#else
49 // POSIX: localtime_r returns tm* (result on success, nullptr on failure)
50 // Parameter order: (time_t*, tm*)
51 return localtime_r(time, result);
52#endif
53}

Referenced by kcenon::pacs::storage::worklist_repository::cleanup_worklist_items_before().

Here is the caller graph for this function: