![]() |
IDS peak ICV v1.1.0
|
Public Member Functions | |
| None | __init__ (self) |
| Initialize an empty metadata container. | |
| None | set_value_by_name (self, str key, Any value) |
| Store a value using a string-based key. | |
| bool | has_entry_by_name (self, str key) |
| Check if a string key is present in the metadata. | |
| Any | try_get_value_by_name (self, str key) |
| Retrieve a value by string key, returning None if not found. | |
| T | get_value_by_name (self, Type[T] expected_type, str key) |
| Retrieve the value for a key and validate that it is of the expected type. | |
| None | set_value_by_key (self, MetadataKey key, Any value) |
| Store a value using a strongly typed metadata key. | |
| bool | has_entry_by_key (self, MetadataKey key) |
| Check if a strongly typed metadata key is present and matches the expected type. | |
| Any | get_value_by_key (self, MetadataKey key) |
| Retrieve the value of a strongly typed metadata key. | |
| List[str] | get_key_names (self) |
| Returns a list of metadata key names. | |
| bool | __eq__ (self, Any other) |
| Check if two metadata are equal. | |
| bool | __ne__ (self, Any other) |
| Check if two metadata are not equal. | |
| str | __str__ (self) |
| Return a human-readable string of metadata keys and values. | |
| str | __repr__ (self) |
| Return an unambiguous string of the Metadata object. | |
Protected Attributes | |
| dict | _data = {} |
A type-safe container for metadata key-value pairs.
This class provides a flexible mechanism for storing and retrieving metadata:
Values are stored in a Python dictionary but accessed with additional safety checks to ensure type correctness.
Example usage::
metadata = Metadata() metadata.set_value_by_key(MetadataKey.DEVICE_FRAME_ID, 1) print(metadata.get_value_by_key(MetadataKey.DEVICE_FRAME_ID)) # outputs: 1 print(metadata.has_entry_by_key(MetadataKey.DEVICE_FRAME_ID)) # outputs: True
Definition at line 9 of file metadata.py.
| None __init__ | ( | self | ) |
Initialize an empty metadata container.
Definition at line 31 of file metadata.py.
| bool __eq__ | ( | self, | |
| Any | other ) |
Check if two metadata are equal.
| other | Another Metadata object |
Definition at line 146 of file metadata.py.
| bool __ne__ | ( | self, | |
| Any | other ) |
Check if two metadata are not equal.
| other | Another metadata object |
Definition at line 159 of file metadata.py.
| str __repr__ | ( | self | ) |
Return an unambiguous string of the Metadata object.
Definition at line 182 of file metadata.py.
| str __str__ | ( | self | ) |
Return a human-readable string of metadata keys and values.
Example: { "DeviceFrameID": 42, "DeviceTimestamp": 1695472000, "custom_data": "xyz" }
Definition at line 170 of file metadata.py.
| List[str] get_key_names | ( | self | ) |
Returns a list of metadata key names.
Definition at line 137 of file metadata.py.
| Any get_value_by_key | ( | self, | |
| MetadataKey | key ) |
Retrieve the value of a strongly typed metadata key.
| key | A MetadataKey object. |
| OutOfRangeException | If the key does not exist. |
| InvalidCastException | If the type does not match. |
Definition at line 116 of file metadata.py.
Retrieve the value for a key and validate that it is of the expected type.
| expected_type | The expected type of the stored value. |
| key | The metadata key. |
| OutOfRangeException | If the key does not exist. |
| InvalidCastException | If the stored type does not match. |
Definition at line 66 of file metadata.py.
| bool has_entry_by_key | ( | self, | |
| MetadataKey | key ) |
Check if a strongly typed metadata key is present and matches the expected type.
| key | A MetadataKey object. |
Definition at line 104 of file metadata.py.
| bool has_entry_by_name | ( | self, | |
| str | key ) |
Check if a string key is present in the metadata.
| key | The metadata key. |
Definition at line 46 of file metadata.py.
| None set_value_by_key | ( | self, | |
| MetadataKey | key, | ||
| Any | value ) |
Store a value using a strongly typed metadata key.
| key | A MetadataKey object containing key name and expected type. |
| value | The value to store. |
| InvalidCastException | If the value type does not match the trait type. |
Definition at line 88 of file metadata.py.
| None set_value_by_name | ( | self, | |
| str | key, | ||
| Any | value ) |
Store a value using a string-based key.
| key | Runtime string string_value. |
| value | Value to store. |
Definition at line 36 of file metadata.py.
| Any try_get_value_by_name | ( | self, | |
| str | key ) |
Retrieve a value by string key, returning None if not found.
| key | The metadata key. |
Definition at line 56 of file metadata.py.
|
protected |
Definition at line 34 of file metadata.py.