PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::example::pacs_server_config Struct Reference

Complete PACS server configuration. More...

#include <config.h>

Collaboration diagram for kcenon::pacs::example::pacs_server_config:
Collaboration graph

Static Public Member Functions

static auto parse_args (int argc, char *argv[]) -> std::optional< pacs_server_config >
 Parse configuration from command line arguments.
 
static void print_help ()
 Print help message to stdout.
 

Public Attributes

server_network_config server
 Server network settings.
 
storage_config storage
 Storage settings.
 
database_config database
 Database settings.
 
logging_config logging
 Logging settings.
 
access_control_config access_control
 Access control settings.
 

Detailed Description

Complete PACS server configuration.

Definition at line 90 of file config.h.

Member Function Documentation

◆ parse_args()

auto kcenon::pacs::example::pacs_server_config::parse_args ( int argc,
char * argv[] ) -> std::optional<pacs_server_config>
static

Parse configuration from command line arguments.

Supported options: –port <port> Port to listen on (default: 11112) –ae-title <title> AE title (default: MY_PACS) –storage-dir <path> Storage directory (default: ./archive) –db-path <path> Database path (default: ./pacs.db) –log-level <level> Log level (default: info) –max-associations <n> Max concurrent associations (default: 50) –help Show help message

Parameters
argcArgument count
argvArgument vector
Returns
Configuration or nullopt if –help was requested or error
Examples
pacs_server/main.cpp.

Definition at line 18 of file config.cpp.

18 : pacs_server [OPTIONS]
19
20Options:
21 --port <port> Port to listen on (default: 11112)
22 --ae-title <title> Application Entity title (default: MY_PACS)
23 --storage-dir <path> Storage directory for DICOM files (default: ./archive)
24 --db-path <path> SQLite database path (default: ./pacs.db)
25 --log-level <level> Log level: trace, debug, info, warning, error, critical
26 (default: info)
27 --max-associations <n> Maximum concurrent associations (default: 50)
28 --help, -h Show this help message
29
30Supported DICOM Services:
31 - C-ECHO (Verification)
32 - C-STORE (Storage)
33 - C-FIND (Query - Patient/Study Root)
34 - C-MOVE/C-GET (Retrieve)
35 - MWL (Modality Worklist)
36 - MPPS (Modality Performed Procedure Step)
37
38Examples:
39 # Start with default settings
40 pacs_server
41
42 # Start on custom port with custom AE title
43 pacs_server --port 104 --ae-title MAIN_PACS
44
45 # Specify storage and database locations
46 pacs_server --storage-dir /data/dicom --db-path /data/pacs.db
47
48)";
49}
50
51auto pacs_server_config::parse_args(int argc, char* argv[])
52 -> std::optional<pacs_server_config> {
53
54 pacs_server_config config;
55
56 for (int i = 1; i < argc; ++i) {
57 const std::string_view arg = argv[i];
58
59 if (arg == "--help" || arg == "-h") {
60 print_help();
61 return std::nullopt;
62 }
63
64 if (arg == "--port") {
65 if (i + 1 >= argc) {
66 std::cerr << "Error: --port requires a value\n";
67 return std::nullopt;
68 }
69 try {
70 config.server.port = static_cast<uint16_t>(std::stoi(argv[++i]));
71 } catch (const std::exception& e) {
72 std::cerr << "Error: Invalid port number\n";
73 return std::nullopt;
74 }
75 continue;
76 }
77
78 if (arg == "--ae-title") {
79 if (i + 1 >= argc) {
80 std::cerr << "Error: --ae-title requires a value\n";
81 return std::nullopt;
82 }
83 config.server.ae_title = argv[++i];
84 if (config.server.ae_title.length() > 16) {
85 std::cerr << "Error: AE title must be 16 characters or less\n";
86 return std::nullopt;
87 }
88 continue;
89 }
90
91 if (arg == "--storage-dir") {
92 if (i + 1 >= argc) {
93 std::cerr << "Error: --storage-dir requires a value\n";
94 return std::nullopt;
95 }
96 config.storage.directory = argv[++i];
97 continue;
98 }
99
100 if (arg == "--db-path") {
101 if (i + 1 >= argc) {
102 std::cerr << "Error: --db-path requires a value\n";
103 return std::nullopt;
104 }
105 config.database.path = argv[++i];
106 continue;
107 }
108
109 if (arg == "--log-level") {
110 if (i + 1 >= argc) {
111 std::cerr << "Error: --log-level requires a value\n";
112 return std::nullopt;
113 }
@ error
Node returned an error.
@ AE
Application Entity (16 chars max)
@ critical
C-ECHO, association handling - highest priority.
database_config database
Database settings.
Definition config.h:98
storage_config storage
Storage settings.
Definition config.h:95

Referenced by main().

Here is the caller graph for this function:

◆ print_help()

void kcenon::pacs::example::pacs_server_config::print_help ( )
static

Print help message to stdout.

Definition at line 14 of file config.cpp.

14 {
15 std::cout << R"(
16PACS Server - Complete DICOM Archive

Member Data Documentation

◆ access_control

access_control_config kcenon::pacs::example::pacs_server_config::access_control

Access control settings.

Definition at line 104 of file config.h.

Referenced by kcenon::pacs::example::pacs_server_app::setup_server().

◆ database

database_config kcenon::pacs::example::pacs_server_config::database

Database settings.

Definition at line 98 of file config.h.

Referenced by kcenon::pacs::example::pacs_server_app::setup_database().

◆ logging

logging_config kcenon::pacs::example::pacs_server_config::logging

Logging settings.

Definition at line 101 of file config.h.

◆ server

server_network_config kcenon::pacs::example::pacs_server_config::server

Server network settings.

Definition at line 92 of file config.h.

Referenced by kcenon::pacs::example::pacs_server_app::setup_server(), and kcenon::pacs::example::pacs_server_app::start().

◆ storage

storage_config kcenon::pacs::example::pacs_server_config::storage

Storage settings.

Definition at line 95 of file config.h.

Referenced by kcenon::pacs::example::pacs_server_app::setup_storage().


The documentation for this struct was generated from the following files: