holoscan::MetadataDictionary
holoscan::MetadataDictionary
Class to define a metadata dictionary object.
Constructors
MetadataDictionary
Copy (with policy)
Copy
Move
Destructor
~MetadataDictionary
Assignment operators
operator=
Copy assign
Move assign
Methods
keys
Get a vector of the keys in the dictionary.
operator[]
Mutable
Const
Provide indexing into the underlying dictionary.
get
Const (1)
Const (2)
Const (with default value)
Get a shared pointer to the MetadataObject corresponding to the provided key.
See the templated variant of get for a version of this method that extracts the std::any value from the MetadataObject and performs the any_cast<ValueT> operation on it.
Returns: The value corresponding to the key
Parameters
The key for the value to retrieve.
set
Overload 1
Insert or update a value at the specified key
Insert a new value at the specified key (or update an existing one).
This method inserts a new item. If the key already exists, this method will have a behavior that depends on the policy (MetadataPolicy) set for this dictionary.
For this method, kInplaceUpdate behaves the same as kUpdate.
Parameters
The key for the value to insert (or update).
The value to store.
policy
Mutable
Const
Set the metadata policy used by this MetadataDictionary.
has_key
Determine if an item already exists in the dictionary.
Returns: Returns true if the key already exists in the dictionary, false otherwise.
Parameters
The key for the value to insert (or update).
erase
Erase an item from the dictionary.
Returns: Returns true if the key was erased and false if the key was not found.
Parameters
The key of the item to erase.
begin
Mutable
Const
begin() iterator of the underlying dictionary
end
Mutable
Const
end() iterator of the underlying dictionary
find
Mutable
Const
find() on the underlying dictionary. Returns an iterator to the element if found, else end()
clear
clear all values from the dictionary
size
return the number of items in the dictionary
swap
swap the contents of this dictionary and other
deep_copy
Create a deep copy of this dictionary.
Creates a new MetadataDictionary with its own independent copy of the underlying map and MetadataObjects. This is useful when you need to store a snapshot of metadata that won’t be affected by subsequent modifications to the original.
Returns: A new MetadataDictionary with independent copies of all data
merge
merge (move) the contents of other dictionary into this dictionary
insert
Insert items the other dictionary into this dictionary.
Pre-existing values are not updated.
update
Update the dictionary with items present in other.
This method will update the dictionary with values from other. If a key already exists in this dictionary, the behavior is determined by the policy (MetadataPolicy) set for this dictionary.
For this method, kInplaceUpdate behaves the same as kUpdate.
Parameters
Metadata dictionary to copy items from
ensure_unique
If the dictionary is shared, make a copy of it so that it is unique.