Class Metadata
Metadata.
Implements
Inherited Members
Namespace: UnityEngine.Perception.GroundTruth.DataModel
Assembly: Unity.Perception.Runtime.dll
Syntax
public class Metadata : IMessageProducer
Constructors
Metadata()
Public constructor for Metadata. Prepares empty dictionary with MetadataEntries
Declaration
public Metadata()
Methods
Add(string, bool)
Adds a new metadata value
Declaration
public void Add(string key, bool value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
bool | value | The value of the metadata |
Add(string, IEnumerable<bool>)
Adds a new metadata value
Declaration
public void Add(string key, IEnumerable<bool> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
IEnumerable<bool> | value | The value of the metadata |
Add(string, IEnumerable<int>)
Adds a new metadata value
Declaration
public void Add(string key, IEnumerable<int> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
IEnumerable<int> | value | The value of the metadata |
Add(string, IEnumerable<float>)
Adds a new metadata value
Declaration
public void Add(string key, IEnumerable<float> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
IEnumerable<float> | value | The value of the metadata |
Add(string, IEnumerable<string>)
Adds a new metadata value
Declaration
public void Add(string key, IEnumerable<string> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
IEnumerable<string> | value | The value of the metadata |
Add(string, IEnumerable<Metadata>)
Adds a new metadata value
Declaration
public void Add(string key, IEnumerable<Metadata> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
IEnumerable<Metadata> | value | The value of the metadata |
Add(string, int)
Adds a new metadata value
Declaration
public void Add(string key, int value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
int | value | The value of the metadata |
Add(string, float)
Adds a new metadata value
Declaration
public void Add(string key, float value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
float | value | The value of the metadata |
Add(string, string)
Adds a new metadata value
Declaration
public void Add(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
string | value | The value of the metadata |
Add(string, uint)
Adds a new metadata value
Declaration
public void Add(string key, uint value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
uint | value | The value of the metadata |
Add(string, Metadata)
Adds a new metadata value
Declaration
public void Add(string key, Metadata value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata |
Metadata | value | The value of the metadata |
FromJson(string)
Parses string to metadata object
Declaration
public static Metadata FromJson(string json)
Parameters
Type | Name | Description |
---|---|---|
string | json | JSON to parse |
Returns
Type | Description |
---|---|
Metadata | New Metadata map |
GetBool(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public bool GetBool(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
bool | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetBoolArray(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public bool[] GetBoolArray(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
bool[] | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetFloat(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public float GetFloat(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
float | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetFloatArray(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public float[] GetFloatArray(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
float[] | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetInt(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public int GetInt(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
int | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetIntArray(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public int[] GetIntArray(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
int[] | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetString(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public string GetString(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
string | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetStringArray(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public string[] GetStringArray(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
string[] | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetSubMetadata(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public Metadata GetSubMetadata(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
Metadata | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
GetSubMetadataArray(string)
Gets a raw SubMetadataArray Value value out of the metadata.
Declaration
public Metadata[] GetSubMetadataArray(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
Metadata[] | Returns Raw Metadata Array |
GetUInt(string)
Gets a value out of the metadata. If the value does not exist, or if a request is made for the improper data type, an exception will be thrown.
Declaration
public uint GetUInt(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Returns
Type | Description |
---|---|
uint | The metadata value |
Exceptions
Type | Condition |
---|---|
ArgumentException | The key was not found in the metadata dictionary |
InvalidOperationException | The query was for the wrong data type |
ToJson()
Convert Metadata object to json string
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
string | Metadata as a JSON in string a value |
ToMessage(IMessageBuilder)
Convert contents int a message.
Declaration
public void ToMessage(IMessageBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
IMessageBuilder | builder | The message builder that will convert the class's contents into a message |
TryGetValue(string, out bool)
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out bool value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
bool | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out bool[])
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out bool[] value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
bool[] | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out int)
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out int value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
int | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out int[])
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out int[] value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
int[] | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out float)
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out float value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
float | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out float[])
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out float[] value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
float[] | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out string)
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out string value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
string | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out string[])
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out string[] value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
string[] | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out uint)
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out uint value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
uint | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out Metadata)
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out Metadata value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Metadata | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |
TryGetValue(string, out Metadata[])
Tries to get a value from the metadata. This method will fail if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type.
Declaration
public bool TryGetValue(string key, out Metadata[] value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the metadata value |
Metadata[] | value | The value associated with the key |
Returns
Type | Description |
---|---|
bool | Returns true if the data was properly retrieved. This method returns false if the key was not found in the metadata, or if the metadata stored with the passed in key is associated with a different data type. |