#include <datadictionary.h>
Class to store and find any data type under any type of key.
Public Types | |
using | Iterator = DataDictionaryIterator |
using | ConstIterator = DataDictionaryIterator |
Public Member Functions | |
MAXON_METHOD Result< void > | SetData (ForwardingDataPtr &&key, const Data &data) |
MAXON_METHOD Result< void > | SetData (ForwardingDataPtr &&key, Data &&data) |
MAXON_METHOD Result< void > | SetData (ForwardingDataPtr &&key, ForwardingDataPtr &&data) |
MAXON_METHOD Result< Data > | GetData (const ConstDataPtr &key) const |
template<typename KEY > | |
MAXON_FUNCTION Bool | Contains (KEY &&key) const |
MAXON_METHOD Result< void > | EraseData (const ConstDataPtr &key) |
MAXON_METHOD void | Reset () |
MAXON_FUNCTION Bool | IsEmpty () const |
MAXON_FUNCTION Bool | IsPopulated () const |
MAXON_METHOD Int | GetCount () const |
MAXON_METHOD String | ToString (const FormatStatement *formatStatement=nullptr) const |
MAXON_METHOD Bool | IsEqual (const DataDictionaryInterface *other, EQUALITY equality) const |
MAXON_METHOD HashInt | GetHashCode () const |
MAXON_METHOD UniqueHash | GetUniqueHashCode () const |
template<typename T = void, typename KEY > | |
MAXON_FUNCTION Result< typename std::conditional< std::is_void< T >::value, typename IsFidClass< KEY >::type, T >::type > | Get (KEY &&key) const |
template<typename T , typename KEY > | |
MAXON_FUNCTION std::conditional< IsFidClass< KEY >::value &&GetCollectionKind< T >::value !=COLLECTION_KIND::ARRAY, typename IsFidClass< KEY >::type, T >::type | Get (KEY &&key, const T &defaultValue) const |
template<typename T , typename KEY > | |
MAXON_FUNCTION std::conditional< IsFidClass< KEY >::value &&GetCollectionKind< T >::value !=COLLECTION_KIND::ARRAY, typename IsFidClass< KEY >::type, T >::type | Get (KEY &&key, T &&defaultValue) const |
template<typename T = void, typename KEY > | |
MAXON_FUNCTION std::conditional< std::is_void< T >::value, typename IsFidClass< KEY >::type, T >::type | GetOrDefault (KEY &&key) const |
template<typename T , typename KEY > | |
MAXON_FUNCTION Result< void > | Set (KEY &&key, T &&data) |
template<typename KEY > | |
MAXON_FUNCTION Result< void > | Erase (KEY &&key) |
template<typename T , typename KEY > | |
MAXON_FUNCTION Result< void > | GetCopy (KEY &&key, T &dst) const |
MAXON_METHOD void | InitIterator (DataDictionaryIteratorInterface *iterator, Bool end) const |
MAXON_FUNCTION ConstIterator | Begin () const |
MAXON_FUNCTION ConstIterator | End () const |
MAXON_METHOD const Data * | PrivateGetData (const ConstDataPtr &key) const |
template<typename T , typename KEY > | |
std::conditional< std::is_void< T >::value, typename IsFidClass< KEY >::type, T >::type | GetOrDefault (KEY &&key) const |
Static Public Member Functions | |
static MAXON_METHOD Result< void > | DescribeIO (const DataSerializeInterface &stream) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (DataDictionaryInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.interface.datadictionary") | |
template<typename T > | |
Result< void > | GetCopyHelper (const Data &data, T &dst, OverloadRank0) const |
template<typename T > | |
std::enable_if< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, Result< void > >::type | GetCopyHelper (const Data &data, T &dst, OverloadRank1) const |
using Iterator = DataDictionaryIterator |
using ConstIterator = DataDictionaryIterator |
|
private |
MAXON_METHOD Result<void> SetData | ( | ForwardingDataPtr && | key, |
const Data & | data | ||
) |
Set Data under a specific id.
[in] | key | Key under which the data is stored. |
[in] | data | Reference to the data. |
MAXON_METHOD Result<void> SetData | ( | ForwardingDataPtr && | key, |
Data && | data | ||
) |
Set Data under a specific id.
[in] | key | Key under which the data should be stored. |
[in] | data | Reference to the data. |
MAXON_METHOD Result<void> SetData | ( | ForwardingDataPtr && | key, |
ForwardingDataPtr && | data | ||
) |
Set Data under a specific id.
[in] | key | Key under which the data should be stored. |
[in] | data | Reference to the data. |
MAXON_METHOD Result<Data> GetData | ( | const ConstDataPtr & | key | ) | const |
MAXON_FUNCTION Bool Contains | ( | KEY && | key | ) | const |
Check if there is data stored under a specific key.
[in] | key | Key under which the data should be stored. |
MAXON_METHOD Result<void> EraseData | ( | const ConstDataPtr & | key | ) |
Remove a data entry from the dictionary. This function doesn't check if the dictionary contained the key.
[in] | key | Key under which the data is stored. |
MAXON_METHOD void Reset | ( | ) |
Frees the entire dictionary. After this call the DataDictionary is empty.
MAXON_FUNCTION Bool IsEmpty | ( | ) | const |
Checks if the dictionary is empty.
MAXON_FUNCTION Bool IsPopulated | ( | ) | const |
Checks if the dictionary contains anything.
MAXON_METHOD Int GetCount | ( | ) | const |
Returns the number of entries in the dictionary.
MAXON_METHOD String ToString | ( | const FormatStatement * | formatStatement = nullptr | ) | const |
Returns a readable string of the content.
[in] | formatStatement | Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported. |
|
static |
Describe all elements of this class for I/O operations.
[in] | stream | The stream that is used to register the class members. |
MAXON_METHOD Bool IsEqual | ( | const DataDictionaryInterface * | other, |
EQUALITY | equality | ||
) | const |
Compares this DataDictionary with another if both are identical.
[in] | other | The other DataDictionary to compare this object with. |
MAXON_METHOD HashInt GetHashCode | ( | ) | const |
Returns the hash code of this @CLASS.
MAXON_METHOD UniqueHash GetUniqueHashCode | ( | ) | const |
Returns the 128-bit hash value of this @CLASS. The implementation ensures uniform distribution, so for practical purposes you can safely assume that two objects are equal if their hash values are equal.
MAXON_FUNCTION Result<typename std::conditional<std::is_void<T>::value, typename IsFidClass<KEY>::type, T>::type> Get | ( | KEY && | key | ) | const |
Get data stored under a specific key. If the key is not found an error will be returned. This functions offers 2 possible calls. First using an FId "dict.Get(MAXCHINEINFO::COMPUTERNAME)" or second using any type directly together with the result type "dict.Get<String>(Int32(5))". The data type needs to be registered.
[in] | key | Key under which the data is stored. |
MAXON_FUNCTION std::conditional<IsFidClass<KEY>::value&& GetCollectionKind<T>::value != COLLECTION_KIND::ARRAY, typename IsFidClass<KEY>::type, T>::type Get | ( | KEY && | key, |
const T & | defaultValue | ||
) | const |
Get data stored under a specific key. If the key is not found the given default value will be returned. This functions offers 2 possible calls. First using an FId "dict.Get(MAXCHINEINFO::COMPUTERNAME, String())" or second using any type directly together with the result type "dict.Get(Int32(5), String())". The data type needs to be registered.
[in] | key | Key under which the data is stored. |
[in] | defaultValue | Default value which should be returned if the key cannot be found. |
MAXON_FUNCTION std::conditional<IsFidClass<KEY>::value&& GetCollectionKind<T>::value != COLLECTION_KIND::ARRAY, typename IsFidClass<KEY>::type, T>::type Get | ( | KEY && | key, |
T && | defaultValue | ||
) | const |
Get data stored under a specific key. If the key is not found the given default value will be returned. This functions offers 2 possible calls. First using an FId "dict.Get(MAXCHINEINFO::COMPUTERNAME, String())" or second using any type directly together with the result type "dict.Get(Int32(5), String())". The data type needs to be registered.
[in] | key | Key under which the data is stored. |
[in] | defaultValue | Default value which should be returned if the key cannot be found. |
MAXON_FUNCTION std::conditional<std::is_void<T>::value, typename IsFidClass<KEY>::type, T>::type GetOrDefault | ( | KEY && | key | ) | const |
Get data stored under a specific key. If the key is not found the given default value will be returned. This functions offers 2 possible calls. First using an FId "dict.Get(MAXCHINEINFO::COMPUTERNAME, String())" or second using any type directly together with the result type "dict.Get(Int32(5), String())". The data type needs to be registered.
[in] | key | Key under which the data is stored. |
MAXON_FUNCTION Result<void> Set | ( | KEY && | key, |
T && | data | ||
) |
Set data under a specific id. this function is template to allow implicit Set calls for each data type. This functions offers 2 possible calls. First using an FId "dict.Set(MAXCHINEINFO::COMPUTERNAME, "data"_s)" or second using any type directly "dict.Set(Int32(5), "data"_s)". The data type needs to be registered.
[in] | key | Key under which the data is stored. |
[in] | data | Data to be stored in the dictionary. |
MAXON_FUNCTION Result<void> Erase | ( | KEY && | key | ) |
Erase data stored under a specific key. This function doesn't check if the dictionary contained the key. This functions offers 2 possible calls. First using an FId "dict.Erase(MAXCHINEINFO::COMPUTERNAME)" or second using any type directly "dict.Erase(Int32(5))". The data type needs to be registered.
[in] | key | Key under which the data is stored. |
MAXON_FUNCTION Result<void> GetCopy | ( | KEY && | key, |
T & | dst | ||
) | const |
Returns a copy of the data stored under a specific id. Can be used for types that do no support copy assignment.
[in] | key | Key under which the data is stored. |
[out] | dst | Used to return the data. |
MAXON_METHOD void InitIterator | ( | DataDictionaryIteratorInterface * | iterator, |
Bool | end | ||
) | const |
Helper functions for iterator.
MAXON_FUNCTION ConstIterator Begin | ( | ) | const |
Returns the begin iterator of the DataDictionary. You can use the Iterator to run through all elements of the DataDictionary.
MAXON_FUNCTION ConstIterator End | ( | ) | const |
Returns the end iterator of the DataDictionary. You can use the Iterator to run through all elements of the DataDictionary.
MAXON_METHOD const Data* PrivateGetData | ( | const ConstDataPtr & | key | ) | const |
Get data stored under a specific id.
[in] | key | Key under which the data should be stored. |
|
private |
|
private |