IDS peak ICV v1.5.0
Loading...
Searching...
No Matches
Metadata Class Referencesealed

Data Structures

class  MetadataAccessor
 Helper class for inter library access. More...
 

Public Member Functions

object GetValueByKey (MetadataKey key)
 Retrieves the value associated with a strongly typed metadata key.
 
T GetValueByKey< T > (MetadataKeyT< T > key)
 Retrieves the value associated with a strongly typed metadata key.
 
object GetValueByName (string name)
 Retrieves a metadata value by its string key.
 
bool TryGetValueByKey (MetadataKey key, out object? value)
 Attempts to retrieve a value associated with a strongly typed metadata key.
 
bool TryGetValueByKey< T > (MetadataKeyT< T > key, out T? value)
 Attempts to retrieve a value associated with a strongly typed metadata key.
 
bool TryGetValueByName (string name, out object? value)
 Attempts to retrieve a metadata value using a string-based key.
 
void RemoveEntryByName (string name)
 Removes the entry using a string-based name. If the key does not exist, nothing happens.
 
void SetValueByKey (MetadataKey key, object value)
 Stores a value associated with a strongly typed metadata key.
 
void SetValueByName (string key, object value)
 Stores a metadata value using a string-based key.
 
bool HasEntryByKey (MetadataKey key)
 Determines whether a value exists for the specified strongly typed key.
 
bool HasEntryByName (string key)
 Determines whether a value exists for the specified string key.
 
override string ToString ()
 Returns a human-readable representation of the metadata contents.
 
Metadata Clone ()
 Creates a copy of this Metadata instance.
 

Properties

IReadOnlyCollection< string > Keys [get]
 Gets a read-only collection of all metadata key names.
 

Events

EventHandler? Changed
 Occurs when a metadata value is modified.
 

Detailed Description

Strongly typed container for image acquisition metadata.

This class provides a flexible key-value store for metadata entries. It supports both string-based keys for dynamic runtime usage and strongly typed keys for compile-time safety. Values are stored internally as objects and can be accessed via casting or generic retrieval methods.

Since
IDSImaging.Peak.Common 1.3

Member Function Documentation

◆ Clone()

Metadata Clone ( )
inline

Creates a copy of this Metadata instance.

All predefined metadata values (see MetadataKeys) are either value types or immutable reference types, so this is effectively a deep copy for standard usage. Custom entries added via SetValueByName that use mutable reference types will share references with the original instance.

Returns
A new Metadata instance containing the same entries.

◆ GetValueByKey()

object GetValueByKey ( MetadataKey key)
inline

Retrieves the value associated with a strongly typed metadata key.

Parameters
keyThe strongly typed metadata key.
Returns
The stored value as an object.
Exceptions
CommonOutOfRangeExceptionThrown when no value exists for the specified key.

◆ GetValueByKey< T >()

T GetValueByKey< T > ( MetadataKeyT< T > key)
inline

Retrieves the value associated with a strongly typed metadata key.

Template Parameters
TThe expected type of the metadata value.
Parameters
keyThe strongly typed metadata key.
Returns
The stored value cast to T .
Exceptions
CommonOutOfRangeExceptionThrown when no value exists for the specified key.
CommonInvalidCastExceptionThrown when the stored value cannot be cast to T .

◆ GetValueByName()

object GetValueByName ( string name)
inline

Retrieves a metadata value by its string key.

Parameters
nameThe metadata entry name.
Returns
The stored value.
Exceptions
CommonOutOfRangeExceptionThrown when no value exists for the specified key.

◆ HasEntryByKey()

bool HasEntryByKey ( MetadataKey key)
inline

Determines whether a value exists for the specified strongly typed key.

Parameters
keyThe metadata key to check.
Returns
true if the key exists; otherwise, false.

◆ HasEntryByName()

bool HasEntryByName ( string key)
inline

Determines whether a value exists for the specified string key.

Parameters
keyThe key name to check.
Returns
true if the key exists; otherwise, false.

◆ RemoveEntryByName()

void RemoveEntryByName ( string name)
inline

Removes the entry using a string-based name. If the key does not exist, nothing happens.

Parameters
nameA runtime string identifier.

◆ SetValueByKey()

void SetValueByKey ( MetadataKey key,
object value )
inline

Stores a value associated with a strongly typed metadata key.

Parameters
keyThe predefined metadata key (for example, MetadataKeys.DeviceTimestamp).
valueThe value to store.
Exceptions
CommonInvalidCastExceptionThrown when the supplied value does not match the type expected by the key.

◆ SetValueByName()

void SetValueByName ( string key,
object value )
inline

Stores a metadata value using a string-based key.

Parameters
keyThe string identifier to associate with the value.
valueThe value to store.

◆ ToString()

override string ToString ( )
inline

Returns a human-readable representation of the metadata contents.

Returns
A string representation of the stored metadata.

◆ TryGetValueByKey()

bool TryGetValueByKey ( MetadataKey key,
out object? value )
inline

Attempts to retrieve a value associated with a strongly typed metadata key.

Parameters
keyThe strongly typed metadata key.
valueWhen this method returns, contains the retrieved value if successful; otherwise, null.
Returns
true if the value exists; otherwise, false.

◆ TryGetValueByKey< T >()

bool TryGetValueByKey< T > ( MetadataKeyT< T > key,
out T? value )
inline

Attempts to retrieve a value associated with a strongly typed metadata key.

Template Parameters
TThe expected type of the metadata value.
Parameters
keyThe strongly typed metadata key.
valueWhen this method returns, contains the retrieved value cast to T if successful; otherwise, the default value for T .
Returns
true if the value exists and matches the type; otherwise, false.

◆ TryGetValueByName()

bool TryGetValueByName ( string name,
out object? value )
inline

Attempts to retrieve a metadata value using a string-based key.

Parameters
nameThe metadata entry name.
valueWhen this method returns, contains the retrieved value if successful; otherwise, null.
Returns
true if the key exists; otherwise, false.

Property Documentation

◆ Keys

IReadOnlyCollection<string> Keys
get

Gets a read-only collection of all metadata key names.

Event Documentation

◆ Changed

EventHandler? Changed

Occurs when a metadata value is modified.

Since
IDSImaging.Peak.Common 1.3