PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
pool_manager.cpp
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
11
12namespace kcenon::pacs::core {
13
14// ============================================================================
15// pool_manager Implementation
16// ============================================================================
17
19 : element_pool_(DEFAULT_ELEMENT_POOL_SIZE)
20 , dataset_pool_(DEFAULT_DATASET_POOL_SIZE) {}
21
22auto pool_manager::get() noexcept -> pool_manager& {
23 thread_local pool_manager instance;
24 return instance;
25}
26
31
34 return dataset_pool_.acquire();
35}
36
37auto pool_manager::element_statistics() const noexcept -> const pool_statistics& {
38 return element_pool_.statistics();
39}
40
41auto pool_manager::dataset_statistics() const noexcept -> const pool_statistics& {
42 return dataset_pool_.statistics();
43}
44
45void pool_manager::reserve_elements(std::size_t count) {
46 element_pool_.reserve(count);
47}
48
49void pool_manager::reserve_datasets(std::size_t count) {
50 dataset_pool_.reserve(count);
51}
52
54 element_pool_.clear();
55 dataset_pool_.clear();
56}
57
59 const_cast<pool_statistics&>(element_pool_.statistics()).reset();
60 const_cast<pool_statistics&>(dataset_pool_.statistics()).reset();
61}
62
63} // namespace kcenon::pacs::core
void reset_statistics()
Reset all statistics.
tracked_pool< dicom_element > element_pool_
void clear_all()
Clear all pools.
auto element_statistics() const noexcept -> const pool_statistics &
Get element pool statistics.
auto acquire_element(dicom_tag tag, encoding::vr_type vr) -> tracked_pool< dicom_element >::unique_ptr_type
Acquire a dicom_element from the pool.
void reserve_elements(std::size_t count)
Reserve capacity in element pool.
static auto get() noexcept -> pool_manager &
Get the thread-local pool manager instance.
void reserve_datasets(std::size_t count)
Reserve capacity in dataset pool.
auto dataset_statistics() const noexcept -> const pool_statistics &
Get dataset pool statistics.
auto acquire_dataset() -> tracked_pool< dicom_dataset >::unique_ptr_type
Acquire a dicom_dataset from the pool.
tracked_pool< dicom_dataset > dataset_pool_
std::unique_ptr< T, std::function< void(T *)> > unique_ptr_type
vr_type
DICOM Value Representation (VR) types.
Definition vr_type.h:29
Centralized object pool management for DICOM objects.
Statistics for object pool usage monitoring.
void reset() noexcept
Reset all statistics.
vr_encoding vr