![]() |
IDS peak AFL v1.8.0
|
Type-safe container for image acquisition metadata. More...
#include <peak_common/types/peak_common_metadata.hpp>
Public Member Functions | |
| template<typename T> | |
| void | SetValueByName (const std::string &key, T &&value) |
| Stores a value using a string-based key. | |
| template<MetadataKey metadataKey, typename T> | |
| void | SetValueByKey (T &&value) |
| Stores a value using a strongly typed metadata key. | |
| PEAK_COMMON_NO_DISCARD bool | HasEntryByName (const std::string &name) const |
| Checks if a given string key is stored in the metadata. | |
| template<MetadataKey metadataKey> | |
| PEAK_COMMON_NO_DISCARD bool | HasEntryByKey () const |
| Checks if a known key is stored in the metadata. | |
| PEAK_COMMON_NO_DISCARD Any | TryGetValueByName (const std::string &key) const |
| Retrieves a value by string key as a type-erased object. | |
| template<typename T> | |
| PEAK_COMMON_NO_DISCARD T | GetValueByName (const std::string &key) const |
| Retrieves and casts the value associated with a string key. | |
| template<MetadataKey metadataKey> | |
| PEAK_COMMON_NO_DISCARD detail::MetadataKeyTraits< metadataKey >::type | GetValueByKey () const |
| Retrieves the value of a strongly typed metadata key. | |
| PEAK_COMMON_NO_DISCARD std::string | ToString () const |
| Returns a string representation of the metadata. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Metadata &metadata) |
| Outputs the metadata keys in human-readable form. | |
Type-safe container for image acquisition metadata.
The Metadata class is a flexible container for storing key-value pairs.
It supports both:
*ByName functions).*ByKey functions).Values are stored using a type-erased mechanism (Any) and can be retrieved either by casting or by trait-based access.
|
inline |
Retrieves the value of a strongly typed metadata key.
Provides type-safe access to known metadata keys, defined in MetadataKey.
| metadataKey | The strongly typed metadata key. |
| peak::common::InvalidCastException | if the stored type does not match the trait definition. |
| peak::common::OutOfRangeException | if the key is not found. |
MetadataKeyTraits<metadataKey>::type.
|
inline |
Retrieves and casts the value associated with a string key.
| T | The expected type of the stored value. |
| key | The name of the metadata entry. |
| peak::common::InvalidCastException | if the stored type does not match T. |
| peak::common::OutOfRangeException | if the key does not exist. |
|
inline |
Checks if a known key is stored in the metadata.
Verifies that the key exists and that the stored type matches the expected trait type.
| metadataKey | The strongly typed metadata key. |
|
inline |
Checks if a given string key is stored in the metadata.
| name | The key to check for. |
|
inline |
Stores a value using a strongly typed metadata key.
Ensures compile-time type safety using known metadata traits.
Known metadata keys are defined in the enum MetadataKey.
| metadataKey | A known metadata key (e.g. MetadataKey::DeviceTimestamp). |
| T | Type of the value. Must match detail::MetadataKeyTraits<metadataKey>::type. |
| value | The value to store. |
|
inline |
Stores a value using a string-based key.
| T | Type of the value to store. |
| key | A runtime string identifier. |
| value | The value to store. |
|
inline |
Returns a string representation of the metadata.
Equivalent to writing the object to a stream with operator<<.
|
inline |
Retrieves a value by string key as a type-erased object.
| key | The name of the metadata entry. |
|
friend |
Outputs the metadata keys in human-readable form.
Values are not printed since their types are unknown at runtime.
| os | The output stream. |
| metadata | The metadata to print. |