|
PACS System 0.1.0
PACS DICOM system library
|
#include <uid_mapping.h>

Public Member Functions | |
| uid_mapping ()=default | |
| Default constructor - creates empty mapping. | |
| uid_mapping (std::string uid_root) | |
| Constructor with custom UID root. | |
| uid_mapping (const uid_mapping &other) | |
| Copy constructor (creates independent copy of mappings) | |
| uid_mapping (uid_mapping &&other) noexcept | |
| Move constructor. | |
| auto | operator= (const uid_mapping &other) -> uid_mapping & |
| Copy assignment. | |
| auto | operator= (uid_mapping &&other) noexcept -> uid_mapping & |
| Move assignment. | |
| ~uid_mapping ()=default | |
| Default destructor. | |
| auto | get_or_create (std::string_view original_uid) -> kcenon::common::Result< std::string > |
| Get existing mapping or create new one. | |
| auto | get_anonymized (std::string_view original_uid) const -> std::optional< std::string > |
| Get existing mapping without creating new one. | |
| auto | get_original (std::string_view anonymized_uid) const -> std::optional< std::string > |
| Get original UID from anonymized UID (reverse lookup) | |
| auto | add_mapping (std::string_view original_uid, std::string_view anonymized_uid) -> kcenon::common::VoidResult |
| Add a specific mapping. | |
| auto | has_mapping (std::string_view original_uid) const -> bool |
| Check if an original UID has been mapped. | |
| auto | size () const -> std::size_t |
| Get the number of mappings. | |
| auto | empty () const -> bool |
| Check if the mapping is empty. | |
| void | clear () |
| Clear all mappings. | |
| auto | remove (std::string_view original_uid) -> bool |
| Remove a specific mapping. | |
| auto | to_json () const -> std::string |
| Export mappings to JSON format. | |
| auto | from_json (std::string_view json) -> kcenon::common::VoidResult |
| Import mappings from JSON format. | |
| auto | merge (const uid_mapping &other) -> std::size_t |
| Merge mappings from another uid_mapping. | |
| void | set_uid_root (std::string root) |
| Set the UID root for generated UIDs. | |
| auto | get_uid_root () const -> std::string |
| Get the current UID root. | |
| auto | generate_uid () const -> std::string |
| Generate a new unique UID. | |
Private Attributes | |
| std::string | uid_root_ {"1.2.826.0.1.3680043.8.498.1"} |
| UID root for generated UIDs (default: pacs_system root) | |
| std::map< std::string, std::string, std::less<> > | original_to_anon_ |
| Forward mapping: original -> anonymized. | |
| std::map< std::string, std::string, std::less<> > | anon_to_original_ |
| Reverse mapping: anonymized -> original. | |
| std::atomic< std::uint64_t > | uid_counter_ {0} |
| Counter for UID generation. | |
| std::shared_mutex | mutex_ |
| Mutex for thread-safe access. | |
Definition at line 59 of file uid_mapping.h.
|
default |
Default constructor - creates empty mapping.
|
explicit |
Constructor with custom UID root.
| uid_root | Custom root for generated UIDs (e.g., "1.2.3.4") |
Definition at line 20 of file uid_mapping.cpp.
| kcenon::pacs::security::uid_mapping::uid_mapping | ( | const uid_mapping & | other | ) |
Copy constructor (creates independent copy of mappings)
Definition at line 23 of file uid_mapping.cpp.
References anon_to_original_, original_to_anon_, kcenon::pacs::security::other, uid_counter_, and uid_root_.
|
noexcept |
Move constructor.
Definition at line 31 of file uid_mapping.cpp.
References kcenon::pacs::security::other.
|
default |
Default destructor.
|
nodiscard |
Add a specific mapping.
Adds a mapping between original and anonymized UIDs. Fails if the original UID is already mapped to a different value.
| original_uid | The original UID |
| anonymized_uid | The anonymized UID |
Definition at line 111 of file uid_mapping.cpp.
| void kcenon::pacs::security::uid_mapping::clear | ( | ) |
Clear all mappings.
Definition at line 153 of file uid_mapping.cpp.
References anon_to_original_, mutex_, and original_to_anon_.
|
nodiscard |
Check if the mapping is empty.
Definition at line 148 of file uid_mapping.cpp.
References mutex_, and original_to_anon_.
Referenced by main().

|
nodiscard |
Import mappings from JSON format.
| json | JSON string containing mappings |
Definition at line 198 of file uid_mapping.cpp.
|
nodiscard |
Generate a new unique UID.
Definition at line 233 of file uid_mapping.cpp.
References uid_counter_, and uid_root_.
|
nodiscard |
Get existing mapping without creating new one.
| original_uid | The original UID to look up |
Definition at line 91 of file uid_mapping.cpp.
|
nodiscard |
Get existing mapping or create new one.
If the original UID has been mapped before, returns the existing anonymized UID. Otherwise, generates a new UID and stores the mapping.
| original_uid | The original UID to map |
Definition at line 61 of file uid_mapping.cpp.
Referenced by kcenon::pacs::security::anonymizer::apply_action().

|
nodiscard |
Get original UID from anonymized UID (reverse lookup)
| anonymized_uid | The anonymized UID to look up |
Definition at line 101 of file uid_mapping.cpp.
|
nodiscard |
Get the current UID root.
Definition at line 228 of file uid_mapping.cpp.
|
nodiscard |
Check if an original UID has been mapped.
| original_uid | The original UID to check |
Definition at line 138 of file uid_mapping.cpp.
| auto kcenon::pacs::security::uid_mapping::merge | ( | const uid_mapping & | other | ) | -> std::size_t |
Merge mappings from another uid_mapping.
Adds all mappings from 'other' that don't conflict with existing mappings.
| other | The uid_mapping to merge from |
Definition at line 207 of file uid_mapping.cpp.
References kcenon::pacs::security::other.
| auto kcenon::pacs::security::uid_mapping::operator= | ( | const uid_mapping & | other | ) | -> uid_mapping& |
Copy assignment.
Definition at line 39 of file uid_mapping.cpp.
References kcenon::pacs::security::other.
|
noexcept |
Move assignment.
Definition at line 50 of file uid_mapping.cpp.
References kcenon::pacs::security::other.
| auto kcenon::pacs::security::uid_mapping::remove | ( | std::string_view | original_uid | ) | -> bool |
Remove a specific mapping.
| original_uid | The original UID to remove |
Definition at line 159 of file uid_mapping.cpp.
| void kcenon::pacs::security::uid_mapping::set_uid_root | ( | std::string | root | ) |
Set the UID root for generated UIDs.
| root | The UID root (e.g., "1.2.3.4") |
Definition at line 223 of file uid_mapping.cpp.
|
nodiscard |
Get the number of mappings.
Definition at line 143 of file uid_mapping.cpp.
References mutex_, and original_to_anon_.
Referenced by main().

|
nodiscard |
Export mappings to JSON format.
Definition at line 174 of file uid_mapping.cpp.
References mutex_, original_to_anon_, and uid_root_.
|
private |
Reverse mapping: anonymized -> original.
Definition at line 243 of file uid_mapping.h.
Referenced by clear(), and uid_mapping().
|
mutableprivate |
Mutex for thread-safe access.
Definition at line 249 of file uid_mapping.h.
Referenced by clear(), empty(), get_uid_root(), set_uid_root(), size(), and to_json().
|
private |
Forward mapping: original -> anonymized.
Definition at line 240 of file uid_mapping.h.
Referenced by clear(), empty(), size(), to_json(), and uid_mapping().
|
mutableprivate |
Counter for UID generation.
Definition at line 246 of file uid_mapping.h.
Referenced by generate_uid(), and uid_mapping().
|
private |
UID root for generated UIDs (default: pacs_system root)
Definition at line 237 of file uid_mapping.h.
Referenced by generate_uid(), get_uid_root(), set_uid_root(), to_json(), and uid_mapping().