Detailed Description
This class stores data values as key/value pairs where the key is a string and the value can be any type.
Inheritance diagram for FiftyOne.Pipeline.Core.Data.DataBase:
Collaboration diagram for FiftyOne.Pipeline.Core.Data.DataBase:
Public Member Functions
DataBase (ILogger< DataBase > logger) | |
DataBase (ILogger< DataBase > logger, IDictionary< string, object > dictionary)
Constructor More...
| |
virtual IReadOnlyDictionary< string, object > | AsDictionary ()
Get the data contained in this instance as an IReadOnlyDictionary<TKey, TValue>. More...
|
void | PopulateFromDictionary (IDictionary< string, object > values)
Use the values in the specified dictionary to populate this data instance. More...
|
Protected Member Functions
virtual T | GetAs< T > (string key)
Get the value associated with the specified key as the specified type. More...
|
Properties
virtual object | this[string key] [get, set]
Get or set a data value More...
|
Properties inherited from FiftyOne.Pipeline.Core.Data.IData | |
object | this[string key] [get, set]
Get or set a data value More...
|
Constructor & Destructor Documentation
◆ DataBase() [2/2]
FiftyOne.Pipeline.Core.Data.DataBase.DataBase | ( | ILogger< DataBase > | logger, |
IDictionary< string, object > | dictionary | ||
) |
Constructor
- Parameters
-
- dictionary - The dictionary instance to use internally when storing data values.
- logger - Used for logging
Member Function Documentation
◆ AsDictionary()
virtual IReadOnlyDictionary<string, object> FiftyOne.Pipeline.Core.Data.DataBase.AsDictionary | ( | ) |
virtual
Get the data contained in this instance as an IReadOnlyDictionary<TKey, TValue>.
- Returns
- The data
Implements FiftyOne.Pipeline.Core.Data.IData.
◆ GetAs< T >()
virtual T FiftyOne.Pipeline.Core.Data.DataBase.GetAs< T > | ( | string | key | ) |
protected
virtual
Get the value associated with the specified key as the specified type.
- Template Parameters
-
- T - The type to return
- Parameters
-
- key - The key to get the value for.
- Returns
- The value associated with the specified key cast to type 'T'. If there is no value for the given key then the default value for the type is returned.
- Exceptions
-
- InvalidCastException - Thrown if the value associated with the specified key cannot be cast to type 'T'
- ArgumentNullException - Thrown if the specified key is null
Reimplemented in FiftyOne.Pipeline.Engines.Data.AspectDataBase.
◆ PopulateFromDictionary()
void FiftyOne.Pipeline.Core.Data.DataBase.PopulateFromDictionary | ( | IDictionary< string, object > | values | ) |
Use the values in the specified dictionary to populate this data instance.
The data will not be cleared before the new values are added. The new values will overwrite old values if any exist with the same keys.
- Parameters
-
- values - The values to transfer to this data instance.
Implements FiftyOne.Pipeline.Core.Data.IData.
Property Documentation
◆ this[string key]
virtual object FiftyOne.Pipeline.Core.Data.DataBase.this[string key] |
get
set
Get or set a data value
- Parameters
-
- key - The name of the property
- Returns
- The property value