#include <peak_common/types/peak_common_metadata.hpp>
Public Types | |
| using | allowedTypes |
Public Member Functions | |
| template<typename T > | |
| void | SetValueByName (const std::string &name, T &&value) |
| Stores a value using a string-based name. | |
| void | RemoveEntryByName (const std::string &name) |
| Removes the entry using a string-based name. | |
| template<MetadataKey metadataKey, typename T > | |
| void | SetValueByKey (T value) |
| Stores a value using a strongly typed metadata key. | |
| bool | HasEntryByName (const std::string &name) const |
| Checks if a given string key is stored in the metadata. | |
| template<MetadataKey metadataKey> | |
| bool | HasEntryByKey () const |
| Checks if a known key is stored in the metadata. | |
| Any | TryGetValueByName (const std::string &name) const |
| Retrieves a value by string name as a type-erased object. | |
| template<typename T > | |
| T | GetValueByName (const std::string &name) const |
| Retrieves and casts the value associated with a string name. | |
| template<MetadataKey metadataKey> | |
| detail::MetadataKeyTraits< metadataKey >::type | GetValueByKey () const |
| Retrieves the value of a strongly typed metadata key. | |
| std::string | ToString () const |
| Returns a string representation of the metadata. | |
| std::vector< std::string > | GetKeyNames () const |
| Returns a vector of key names. | |
Friends | |
| struct | detail::MetadataAccessor |
| 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 (peak::common::Any) and can be retrieved either by casting or by trait-based access.
| using allowedTypes |
|
inline |
Returns a vector of key names.
|
inline |
Retrieves the value of a strongly typed metadata key.
Provides type-safe access to known metadata keys, defined in peak::common::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 name.
| T | The expected type of the stored value. |
| name | The name of the metadata entry. |
| peak::common::InvalidCastException | if the stored type does not match T. |
| peak::common::OutOfRangeException | if the name 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 |
Removes the entry using a string-based name.
If the key does not exist, nothing happens.
| name | A runtime string identifier. |
|
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 peak::common::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 name.
| T | Type of the value to store. |
| name | 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 name as a type-erased object.
| name | The name of the metadata entry. |
|
friend |
|
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. |