PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::samples::production_pacs Class Reference

#include <production_pacs.h>

Collaboration diagram for kcenon::pacs::samples::production_pacs:
Collaboration graph

Public Member Functions

 production_pacs (const production_config &config)
 Construct Production PACS with configuration.
 
 ~production_pacs ()
 Destructor - ensures clean shutdown.
 
 production_pacs (const production_pacs &)=delete
 
production_pacs & operator= (const production_pacs &)=delete
 
 production_pacs (production_pacs &&)=delete
 
production_pacs & operator= (production_pacs &&)=delete
 
bool start ()
 Start the production PACS server.
 
void stop ()
 Stop the production PACS server.
 
void wait ()
 Block until server shutdown.
 
bool is_running () const noexcept
 Check if server is running.
 
void on_image_received (std::function< void(const events::image_received_event &)> handler)
 Register handler for image received events.
 
void on_query_executed (std::function< void(const events::query_executed_event &)> handler)
 Register handler for query executed events.
 
void on_association_event (std::function< void(const events::association_event &)> handler)
 Register handler for association events.
 
void on_access_denied (std::function< void(const events::access_denied_event &)> handler)
 Register handler for access denied events.
 
void print_status () const
 Print server status to stdout.
 
const production_statistics & statistics () const noexcept
 Get current statistics.
 
monitoring::health_status get_health () const
 Get health status.
 
void export_statistics (const std::filesystem::path &path) const
 Export statistics to JSON file.
 
const production_config & config () const noexcept
 Get the configuration.
 

Private Member Functions

void setup_mini_pacs ()
 
void setup_security ()
 
void setup_anonymization ()
 
void setup_rest_api ()
 
void setup_monitoring ()
 
void setup_event_handlers ()
 
void dispatch_image_received (const events::image_received_event &event)
 
void dispatch_query_executed (const events::query_executed_event &event)
 
void dispatch_association_event (const events::association_event &event)
 
void dispatch_access_denied (const events::access_denied_event &event)
 

Private Attributes

production_config config_
 
production_statistics stats_
 
std::unique_ptr< mini_pacs > pacs_
 
std::shared_ptr< security::access_control_manager > access_control_
 
std::unique_ptr< security::anonymizer > anonymizer_
 
std::unique_ptr< web::rest_server > rest_server_
 
std::shared_ptr< monitoring::health_checker > health_checker_
 
std::shared_ptr< monitoring::pacs_metrics > metrics_
 
std::vector< std::function< void(const events::image_received_event &)> > image_handlers_
 
std::vector< std::function< void(const events::query_executed_event &)> > query_handlers_
 
std::vector< std::function< void(const events::association_event &)> > association_handlers_
 
std::vector< std::function< void(const events::access_denied_event &)> > access_denied_handlers_
 
std::mutex handlers_mutex_
 
std::mutex shutdown_mutex_
 
std::condition_variable shutdown_cv_
 
std::atomic< bool > running_ {false}
 

Detailed Description

Definition at line 195 of file production_pacs.h.

Constructor & Destructor Documentation

◆ production_pacs() [1/3]

kcenon::pacs::samples::production_pacs::production_pacs ( const production_config & config)
explicit

Construct Production PACS with configuration.

Parameters
configProduction configuration
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 22 of file production_pacs.cpp.

23 : config_(config) {
24 stats_.start_time = std::chrono::system_clock::now();
25}
const production_config & config() const noexcept
Get the configuration.
std::chrono::system_clock::time_point start_time
Server uptime start.

References kcenon::pacs::samples::production_statistics::start_time, and stats_.

◆ ~production_pacs()

kcenon::pacs::samples::production_pacs::~production_pacs ( )

Destructor - ensures clean shutdown.

Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 27 of file production_pacs.cpp.

27 {
28 if (running_) {
29 stop();
30 }
31}
void stop()
Stop the production PACS server.

References running_, and stop().

Here is the call graph for this function:

◆ production_pacs() [2/3]

kcenon::pacs::samples::production_pacs::production_pacs ( const production_pacs & )
delete

◆ production_pacs() [3/3]

kcenon::pacs::samples::production_pacs::production_pacs ( production_pacs && )
delete

Member Function Documentation

◆ config()

const production_config & kcenon::pacs::samples::production_pacs::config ( ) const
nodiscardnoexcept

Get the configuration.

Returns
Reference to configuration
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 225 of file production_pacs.cpp.

225 {
226 return config_;
227}

References config_.

◆ dispatch_access_denied()

void kcenon::pacs::samples::production_pacs::dispatch_access_denied ( const events::access_denied_event & event)
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 353 of file production_pacs.cpp.

353 {
354 std::lock_guard<std::mutex> lock(handlers_mutex_);
356 for (const auto& handler : access_denied_handlers_) {
357 try {
358 handler(event);
359 } catch (const std::exception& e) {
360 std::cerr << "Error in access denied handler: " << e.what() << "\n";
361 }
362 }
363}
std::vector< std::function< void(const events::access_denied_event &)> > access_denied_handlers_
std::atomic< std::uint64_t > access_denied_count
Total access denied events.

References kcenon::pacs::samples::production_statistics::access_denied_count, access_denied_handlers_, handlers_mutex_, and stats_.

◆ dispatch_association_event()

void kcenon::pacs::samples::production_pacs::dispatch_association_event ( const events::association_event & event)
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 342 of file production_pacs.cpp.

342 {
343 std::lock_guard<std::mutex> lock(handlers_mutex_);
344 for (const auto& handler : association_handlers_) {
345 try {
346 handler(event);
347 } catch (const std::exception& e) {
348 std::cerr << "Error in association event handler: " << e.what() << "\n";
349 }
350 }
351}
std::vector< std::function< void(const events::association_event &)> > association_handlers_

References association_handlers_, and handlers_mutex_.

◆ dispatch_image_received()

void kcenon::pacs::samples::production_pacs::dispatch_image_received ( const events::image_received_event & event)
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 320 of file production_pacs.cpp.

320 {
321 std::lock_guard<std::mutex> lock(handlers_mutex_);
322 for (const auto& handler : image_handlers_) {
323 try {
324 handler(event);
325 } catch (const std::exception& e) {
326 std::cerr << "Error in image received handler: " << e.what() << "\n";
327 }
328 }
329}
std::vector< std::function< void(const events::image_received_event &)> > image_handlers_

References handlers_mutex_, and image_handlers_.

◆ dispatch_query_executed()

void kcenon::pacs::samples::production_pacs::dispatch_query_executed ( const events::query_executed_event & event)
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 331 of file production_pacs.cpp.

331 {
332 std::lock_guard<std::mutex> lock(handlers_mutex_);
333 for (const auto& handler : query_handlers_) {
334 try {
335 handler(event);
336 } catch (const std::exception& e) {
337 std::cerr << "Error in query executed handler: " << e.what() << "\n";
338 }
339 }
340}
std::vector< std::function< void(const events::query_executed_event &)> > query_handlers_

References handlers_mutex_, and query_handlers_.

◆ export_statistics()

void kcenon::pacs::samples::production_pacs::export_statistics ( const std::filesystem::path & path) const

Export statistics to JSON file.

Parameters
pathOutput file path
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 196 of file production_pacs.cpp.

196 {
197 std::ofstream file(path);
198 if (!file.is_open()) {
199 std::cerr << "Failed to open statistics file: " << path << "\n";
200 return;
201 }
202
203 auto uptime = stats_.uptime();
204
205 file << "{\n";
206 file << " \"uptime_seconds\": " << uptime.count() << ",\n";
207 file << " \"images_stored\": " << stats_.images_stored.load() << ",\n";
208 file << " \"images_anonymized\": " << stats_.images_anonymized.load() << ",\n";
209 file << " \"queries_executed\": " << stats_.queries_executed.load() << ",\n";
210 file << " \"access_denied_count\": " << stats_.access_denied_count.load() << ",\n";
211 file << " \"rest_requests\": " << stats_.rest_requests.load() << ",\n";
212 file << " \"active_associations\": " << stats_.active_associations.load() << ",\n";
213 file << " \"server\": {\n";
214 file << " \"ae_title\": \"" << config_.server.ae_title << "\",\n";
215 file << " \"port\": " << config_.server.port << ",\n";
216 file << " \"tls_enabled\": " << (config_.server.tls.enabled ? "true" : "false") << "\n";
217 file << " },\n";
218 file << " \"rest_api\": {\n";
219 file << " \"enabled\": " << (config_.rest_api.enabled ? "true" : "false") << ",\n";
220 file << " \"port\": " << config_.rest_api.port << "\n";
221 file << " }\n";
222 file << "}\n";
223}
rest_api_config rest_api
REST API settings.
server_config server
DICOM server settings.
std::atomic< std::uint64_t > images_stored
Total images stored.
std::atomic< std::uint64_t > images_anonymized
Total images anonymized.
std::atomic< std::uint64_t > rest_requests
Total REST API requests.
std::atomic< std::uint64_t > queries_executed
Total queries executed.
auto uptime() const -> std::chrono::seconds
Get uptime duration.
std::atomic< std::uint32_t > active_associations
Current active DICOM associations.
std::uint16_t port
HTTP port for REST API.
bool enabled
Enable REST API server.
std::uint16_t port
TCP port for DICOM connections.
tls_config tls
TLS configuration.
std::string ae_title
Application Entity title (max 16 characters)
bool enabled
Enable TLS for DICOM connections.

References kcenon::pacs::samples::production_statistics::access_denied_count, kcenon::pacs::samples::production_statistics::active_associations, kcenon::pacs::samples::server_config::ae_title, config_, kcenon::pacs::samples::rest_api_config::enabled, kcenon::pacs::samples::tls_config::enabled, kcenon::pacs::samples::production_statistics::images_anonymized, kcenon::pacs::samples::production_statistics::images_stored, kcenon::pacs::samples::rest_api_config::port, kcenon::pacs::samples::server_config::port, kcenon::pacs::samples::production_statistics::queries_executed, kcenon::pacs::samples::production_config::rest_api, kcenon::pacs::samples::production_statistics::rest_requests, kcenon::pacs::samples::production_config::server, stats_, kcenon::pacs::samples::server_config::tls, and kcenon::pacs::samples::production_statistics::uptime().

Here is the call graph for this function:

◆ get_health()

monitoring::health_status kcenon::pacs::samples::production_pacs::get_health ( ) const
nodiscard

Get health status.

Returns
Current health status
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 189 of file production_pacs.cpp.

189 {
190 if (health_checker_) {
191 return health_checker_->get_cached_status();
192 }
193 return monitoring::health_status{};
194}
std::shared_ptr< monitoring::health_checker > health_checker_

References health_checker_.

◆ is_running()

bool kcenon::pacs::samples::production_pacs::is_running ( ) const
nodiscardnoexcept

Check if server is running.

Returns
true if running
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 101 of file production_pacs.cpp.

101 {
102 return running_;
103}

References running_.

◆ on_access_denied()

void kcenon::pacs::samples::production_pacs::on_access_denied ( std::function< void(const events::access_denied_event &)> handler)

Register handler for access denied events.

Parameters
handlerCallback function
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 127 of file production_pacs.cpp.

128 {
129 std::lock_guard<std::mutex> lock(handlers_mutex_);
130 access_denied_handlers_.push_back(std::move(handler));
131}

References access_denied_handlers_, and handlers_mutex_.

◆ on_association_event()

void kcenon::pacs::samples::production_pacs::on_association_event ( std::function< void(const events::association_event &)> handler)

Register handler for association events.

Parameters
handlerCallback function
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 121 of file production_pacs.cpp.

122 {
123 std::lock_guard<std::mutex> lock(handlers_mutex_);
124 association_handlers_.push_back(std::move(handler));
125}

References association_handlers_, and handlers_mutex_.

◆ on_image_received()

void kcenon::pacs::samples::production_pacs::on_image_received ( std::function< void(const events::image_received_event &)> handler)

Register handler for image received events.

Parameters
handlerCallback function
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 109 of file production_pacs.cpp.

110 {
111 std::lock_guard<std::mutex> lock(handlers_mutex_);
112 image_handlers_.push_back(std::move(handler));
113}

References handlers_mutex_, and image_handlers_.

◆ on_query_executed()

void kcenon::pacs::samples::production_pacs::on_query_executed ( std::function< void(const events::query_executed_event &)> handler)

Register handler for query executed events.

Parameters
handlerCallback function
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 115 of file production_pacs.cpp.

116 {
117 std::lock_guard<std::mutex> lock(handlers_mutex_);
118 query_handlers_.push_back(std::move(handler));
119}

References handlers_mutex_, and query_handlers_.

◆ operator=() [1/2]

◆ operator=() [2/2]

production_pacs & kcenon::pacs::samples::production_pacs::operator= ( production_pacs && )
delete

◆ print_status()

void kcenon::pacs::samples::production_pacs::print_status ( ) const

Print server status to stdout.

Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 137 of file production_pacs.cpp.

137 {
138 auto uptime = stats_.uptime();
139 auto hours = std::chrono::duration_cast<std::chrono::hours>(uptime);
140 auto minutes = std::chrono::duration_cast<std::chrono::minutes>(uptime) % 60;
141 auto seconds = uptime.count() % 60;
142
143 std::ostringstream uptime_str;
144 uptime_str << hours.count() << "h " << minutes.count() << "m " << seconds << "s";
145
146 std::cout << "\n";
147 std::cout << "╔══════════════════════════════════════════════════════════════════╗\n";
148 std::cout << "║ Production PACS Server Status ║\n";
149 std::cout << "╠══════════════════════════════════════════════════════════════════╣\n";
150 std::cout << "║ Server: ║\n";
151 std::cout << "║ AE Title: " << std::setw(48) << std::left
152 << config_.server.ae_title << "║\n";
153 std::cout << "║ DICOM Port: " << std::setw(48) << std::left
154 << config_.server.port << "║\n";
155 std::cout << "║ TLS: " << std::setw(48) << std::left
156 << (config_.server.tls.enabled ? "Enabled" : "Disabled") << "║\n";
157 std::cout << "╠══════════════════════════════════════════════════════════════════╣\n";
158 std::cout << "║ REST API: ║\n";
159 std::cout << "║ Status: " << std::setw(48) << std::left
160 << (config_.rest_api.enabled ? "Enabled" : "Disabled") << "║\n";
162 std::cout << "║ Port: " << std::setw(48) << std::left
163 << config_.rest_api.port << "║\n";
164 }
165 std::cout << "╠══════════════════════════════════════════════════════════════════╣\n";
166 std::cout << "║ Security: ║\n";
167 std::cout << "║ RBAC: " << std::setw(48) << std::left
168 << (config_.security.access_control.enabled ? "Enabled" : "Disabled") << "║\n";
169 std::cout << "║ Auto-Anon: " << std::setw(48) << std::left
170 << (config_.security.anonymization.auto_anonymize ? "Enabled" : "Disabled")
171 << "║\n";
172 std::cout << "╠══════════════════════════════════════════════════════════════════╣\n";
173 std::cout << "║ Statistics: ║\n";
174 std::cout << "║ Uptime: " << std::setw(48) << std::left
175 << uptime_str.str() << "║\n";
176 std::cout << "║ Images: " << std::setw(48) << std::left
177 << stats_.images_stored.load() << "║\n";
178 std::cout << "║ Queries: " << std::setw(48) << std::left
179 << stats_.queries_executed.load() << "║\n";
180 std::cout << "║ Associations:" << std::setw(48) << std::left
181 << stats_.active_associations.load() << "║\n";
182 std::cout << "╚══════════════════════════════════════════════════════════════════╝\n\n";
183}
bool enabled
Enable access control enforcement.
bool auto_anonymize
Automatically anonymize incoming images.
security_config security
Security settings.
access_control_config access_control
Access control settings.
anonymization_config anonymization
Anonymization settings.

References kcenon::pacs::samples::security_config::access_control, kcenon::pacs::samples::production_statistics::active_associations, kcenon::pacs::samples::server_config::ae_title, kcenon::pacs::samples::security_config::anonymization, kcenon::pacs::samples::anonymization_config::auto_anonymize, config_, kcenon::pacs::samples::access_control_config::enabled, kcenon::pacs::samples::rest_api_config::enabled, kcenon::pacs::samples::tls_config::enabled, kcenon::pacs::samples::production_statistics::images_stored, kcenon::pacs::samples::rest_api_config::port, kcenon::pacs::samples::server_config::port, kcenon::pacs::samples::production_statistics::queries_executed, kcenon::pacs::samples::production_config::rest_api, kcenon::pacs::samples::production_config::security, kcenon::pacs::samples::production_config::server, stats_, kcenon::pacs::samples::server_config::tls, and kcenon::pacs::samples::production_statistics::uptime().

Here is the call graph for this function:

◆ setup_anonymization()

void kcenon::pacs::samples::production_pacs::setup_anonymization ( )
private

◆ setup_event_handlers()

void kcenon::pacs::samples::production_pacs::setup_event_handlers ( )
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 310 of file production_pacs.cpp.

310 {
311 // Note: In a real implementation, we would hook into the Mini PACS
312 // event system. For this sample, we demonstrate the event architecture
313 // without full integration to keep the sample focused.
314}

Referenced by start().

Here is the caller graph for this function:

◆ setup_mini_pacs()

void kcenon::pacs::samples::production_pacs::setup_mini_pacs ( )
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 233 of file production_pacs.cpp.

233 {
234 mini_pacs_config pacs_config;
235 pacs_config.ae_title = config_.server.ae_title;
236 pacs_config.port = config_.server.port;
237 pacs_config.storage_path = config_.storage.root_path;
238 pacs_config.max_associations = config_.server.max_associations;
239 pacs_config.enable_worklist = true;
240 pacs_config.enable_mpps = true;
241 pacs_config.verbose_logging = (config_.logging.level == "debug");
242
243 pacs_ = std::make_unique<mini_pacs>(pacs_config);
244}
std::unique_ptr< mini_pacs > pacs_
std::string level
Log level: "debug", "info", "warn", "error".
logging_config logging
Logging settings.
storage_config storage
Storage settings.
std::size_t max_associations
Maximum concurrent associations.
std::filesystem::path root_path
Root path for DICOM file storage.

References kcenon::pacs::samples::mini_pacs_config::ae_title, kcenon::pacs::samples::server_config::ae_title, config_, kcenon::pacs::samples::mini_pacs_config::enable_mpps, kcenon::pacs::samples::mini_pacs_config::enable_worklist, kcenon::pacs::samples::logging_config::level, kcenon::pacs::samples::production_config::logging, kcenon::pacs::samples::mini_pacs_config::max_associations, kcenon::pacs::samples::server_config::max_associations, pacs_, kcenon::pacs::samples::mini_pacs_config::port, kcenon::pacs::samples::server_config::port, kcenon::pacs::samples::storage_config::root_path, kcenon::pacs::samples::production_config::server, kcenon::pacs::samples::production_config::storage, kcenon::pacs::samples::mini_pacs_config::storage_path, and kcenon::pacs::samples::mini_pacs_config::verbose_logging.

Referenced by start().

Here is the caller graph for this function:

◆ setup_monitoring()

void kcenon::pacs::samples::production_pacs::setup_monitoring ( )
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 293 of file production_pacs.cpp.

293 {
294 // Setup health checker
295 monitoring::health_checker_config health_config;
296 health_config.check_interval = config_.monitoring.health_check_interval;
297 health_config.cache_duration = std::chrono::seconds{5};
298 health_config.storage_warning_threshold = 80.0;
299 health_config.storage_critical_threshold = 95.0;
300
301 health_checker_ = std::make_shared<monitoring::health_checker>(health_config);
302 health_checker_->set_version(0, 1, 0, "production_pacs");
303
304 // Setup metrics
306 metrics_ = std::make_shared<monitoring::pacs_metrics>();
307 }
308}
std::shared_ptr< monitoring::pacs_metrics > metrics_
std::chrono::seconds health_check_interval
Interval between health checks (seconds)
bool metrics_enabled
Enable Prometheus-style metrics endpoint.
monitoring_config monitoring
Monitoring settings.

References kcenon::pacs::monitoring::health_checker_config::cache_duration, kcenon::pacs::monitoring::health_checker_config::check_interval, config_, kcenon::pacs::samples::monitoring_config::health_check_interval, health_checker_, metrics_, kcenon::pacs::samples::monitoring_config::metrics_enabled, kcenon::pacs::samples::production_config::monitoring, kcenon::pacs::monitoring::health_checker_config::storage_critical_threshold, and kcenon::pacs::monitoring::health_checker_config::storage_warning_threshold.

Referenced by start().

Here is the caller graph for this function:

◆ setup_rest_api()

void kcenon::pacs::samples::production_pacs::setup_rest_api ( )
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 269 of file production_pacs.cpp.

269 {
270 if (!config_.rest_api.enabled) {
271 return;
272 }
273
274 web::rest_server_config rest_config;
275 rest_config.port = config_.rest_api.port;
276 rest_config.enable_cors = config_.rest_api.cors_enabled;
277 rest_config.concurrency = 4;
278
279 rest_server_ = std::make_unique<web::rest_server>(rest_config);
280
281 // Integrate with monitoring
282 if (health_checker_) {
283 rest_server_->set_health_checker(health_checker_);
284 }
285 if (metrics_) {
286 rest_server_->set_metrics_provider(metrics_);
287 }
288 if (access_control_) {
289 rest_server_->set_access_control_manager(access_control_);
290 }
291}
std::unique_ptr< web::rest_server > rest_server_
std::shared_ptr< security::access_control_manager > access_control_
bool cors_enabled
Enable CORS for web clients.

References access_control_, kcenon::pacs::web::rest_server_config::concurrency, config_, kcenon::pacs::samples::rest_api_config::cors_enabled, kcenon::pacs::web::rest_server_config::enable_cors, kcenon::pacs::samples::rest_api_config::enabled, health_checker_, metrics_, kcenon::pacs::samples::rest_api_config::port, kcenon::pacs::web::rest_server_config::port, kcenon::pacs::samples::production_config::rest_api, and rest_server_.

Referenced by start().

Here is the caller graph for this function:

◆ setup_security()

void kcenon::pacs::samples::production_pacs::setup_security ( )
private
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 246 of file production_pacs.cpp.

246 {
248 return;
249 }
250
251 access_control_ = std::make_shared<security::access_control_manager>();
252
253 // Register allowed AE titles
254 for (const auto& ae_title : config_.security.allowed_ae_titles) {
255 // For simplicity, map AE titles to users with viewer role
256 access_control_->register_ae_title(ae_title, ae_title);
257 }
258}
std::vector< std::string > allowed_ae_titles
Allowed AE titles (supports wildcards with *)

References kcenon::pacs::samples::security_config::access_control, access_control_, kcenon::pacs::samples::security_config::allowed_ae_titles, config_, kcenon::pacs::samples::access_control_config::enabled, and kcenon::pacs::samples::production_config::security.

Referenced by start().

Here is the caller graph for this function:

◆ start()

bool kcenon::pacs::samples::production_pacs::start ( )
nodiscard

Start the production PACS server.

Returns
true if started successfully
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 37 of file production_pacs.cpp.

37 {
38 if (running_) {
39 return true;
40 }
41
42 try {
43 // Initialize components in order
50
51 // Start Mini PACS
52 if (!pacs_->start()) {
53 std::cerr << "Failed to start Mini PACS\n";
54 return false;
55 }
56
57 // Start REST API if enabled
59 rest_server_->start_async();
60 }
61
62 running_ = true;
63 return true;
64
65 } catch (const std::exception& e) {
66 std::cerr << "Failed to start Production PACS: " << e.what() << "\n";
67 return false;
68 }
69}

References config_, kcenon::pacs::samples::rest_api_config::enabled, pacs_, kcenon::pacs::samples::production_config::rest_api, rest_server_, running_, setup_anonymization(), setup_event_handlers(), setup_mini_pacs(), setup_monitoring(), setup_rest_api(), and setup_security().

Here is the call graph for this function:

◆ statistics()

const production_statistics & kcenon::pacs::samples::production_pacs::statistics ( ) const
nodiscardnoexcept

Get current statistics.

Returns
Reference to statistics structure
Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 185 of file production_pacs.cpp.

185 {
186 return stats_;
187}

References stats_.

◆ stop()

void kcenon::pacs::samples::production_pacs::stop ( )

Stop the production PACS server.

Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 71 of file production_pacs.cpp.

71 {
72 if (!running_) {
73 return;
74 }
75
76 running_ = false;
77
78 // Stop REST API
79 if (rest_server_) {
80 rest_server_->stop();
81 }
82
83 // Stop Mini PACS
84 if (pacs_) {
85 pacs_->stop();
86 }
87
88 // Notify waiting threads
89 shutdown_cv_.notify_all();
90}

References pacs_, rest_server_, running_, and shutdown_cv_.

Referenced by ~production_pacs().

Here is the caller graph for this function:

◆ wait()

void kcenon::pacs::samples::production_pacs::wait ( )

Block until server shutdown.

Examples
/home/runner/work/pacs_system/pacs_system/examples/tutorials/05_production_pacs/production_pacs.h.

Definition at line 92 of file production_pacs.cpp.

92 {
93 if (!running_) {
94 return;
95 }
96
97 std::unique_lock<std::mutex> lock(shutdown_mutex_);
98 shutdown_cv_.wait(lock, [this] { return !running_.load(); });
99}

References running_, shutdown_cv_, and shutdown_mutex_.

Member Data Documentation

◆ access_control_

std::shared_ptr<security::access_control_manager> kcenon::pacs::samples::production_pacs::access_control_
private

◆ access_denied_handlers_

std::vector<std::function<void(const events::access_denied_event&)> > kcenon::pacs::samples::production_pacs::access_denied_handlers_
private

◆ anonymizer_

std::unique_ptr<security::anonymizer> kcenon::pacs::samples::production_pacs::anonymizer_
private

◆ association_handlers_

std::vector<std::function<void(const events::association_event&)> > kcenon::pacs::samples::production_pacs::association_handlers_
private

◆ config_

◆ handlers_mutex_

◆ health_checker_

std::shared_ptr<monitoring::health_checker> kcenon::pacs::samples::production_pacs::health_checker_
private

◆ image_handlers_

std::vector<std::function<void(const events::image_received_event&)> > kcenon::pacs::samples::production_pacs::image_handlers_
private

◆ metrics_

std::shared_ptr<monitoring::pacs_metrics> kcenon::pacs::samples::production_pacs::metrics_
private

◆ pacs_

std::unique_ptr<mini_pacs> kcenon::pacs::samples::production_pacs::pacs_
private

◆ query_handlers_

std::vector<std::function<void(const events::query_executed_event&)> > kcenon::pacs::samples::production_pacs::query_handlers_
private

◆ rest_server_

std::unique_ptr<web::rest_server> kcenon::pacs::samples::production_pacs::rest_server_
private

◆ running_

std::atomic<bool> kcenon::pacs::samples::production_pacs::running_ {false}
private

◆ shutdown_cv_

std::condition_variable kcenon::pacs::samples::production_pacs::shutdown_cv_
private

◆ shutdown_mutex_

std::mutex kcenon::pacs::samples::production_pacs::shutdown_mutex_
private

◆ stats_


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