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

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 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

Definition at line 232 of file Metadata.cs.

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.

Definition at line 442 of file Metadata.cs.

◆ 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.

Definition at line 244 of file Metadata.cs.

◆ 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 .

Definition at line 263 of file Metadata.cs.

◆ 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.

Definition at line 285 of file Metadata.cs.

◆ 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.

Definition at line 407 of file Metadata.cs.

◆ 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.

Definition at line 417 of file Metadata.cs.

◆ 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.

Definition at line 369 of file Metadata.cs.

◆ 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.

Definition at line 391 of file Metadata.cs.

◆ ToString()

override string ToString ( )
inline

Returns a human-readable representation of the metadata contents.

Returns
A string representation of the stored metadata.

Definition at line 426 of file Metadata.cs.

◆ 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.

Definition at line 308 of file Metadata.cs.

◆ 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.

Definition at line 325 of file Metadata.cs.

◆ 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.

Definition at line 348 of file Metadata.cs.

Property Documentation

◆ Keys

IReadOnlyCollection<string> Keys
get

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

Definition at line 356 of file Metadata.cs.

Event Documentation

◆ Changed

EventHandler? Changed

Occurs when a metadata value is modified.

Since
IDSImaging.Peak.Common 1.3

Definition at line 455 of file Metadata.cs.