HDK
|
Functions | |
template<typename T > | |
bool | VtDictionaryIsHolding (const VtDictionary &dictionary, const std::string &key) |
template<typename T > | |
const T & | VtDictionaryGet (const VtDictionary &dictionary, const std::string &key) |
template<class T , class U > | |
T | VtDictionaryGet (const VtDictionary &dictionary, const std::string &key, Vt_DefaultHolder< U > const &def) |
VT_API VtDictionary | VtDictionaryOver (const VtDictionary &strong, const VtDictionary &weak, bool coerceToWeakerOpinionType=false) |
VT_API void | VtDictionaryOver (VtDictionary *strong, const VtDictionary &weak, bool coerceToWeakerOpinionType=false) |
VT_API void | VtDictionaryOver (const VtDictionary &strong, VtDictionary *weak, bool coerceToWeakerOpinionType=false) |
VT_API VtDictionary | VtDictionaryOverRecursive (const VtDictionary &strong, const VtDictionary &weak, bool coerceToWeakerOpinionType=false) |
VT_API void | VtDictionaryOverRecursive (VtDictionary *strong, const VtDictionary &weak, bool coerceToWeakerOpinionType=false) |
VT_API void | VtDictionaryOverRecursive (const VtDictionary &strong, VtDictionary *weak, bool coerceToWeakerOpinionType=false) |
Functions for manipulating VtDictionary objects.
const T& VtDictionaryGet | ( | const VtDictionary & | dictionary, |
const std::string & | key | ||
) |
Return a value held in a VtDictionary by reference.
If key
is in dictionary
and the corresponding value is of type T
, returns a reference to the value.
key
is not in dictionary
, or the value for key
is of the wrong type, a fatal error occurs, so clients should always call VtDictionaryIsHolding first. Definition at line 454 of file dictionary.h.
T VtDictionaryGet | ( | const VtDictionary & | dictionary, |
const std::string & | key, | ||
Vt_DefaultHolder< U > const & | def | ||
) |
Return a value held in a VtDictionary, or a default value either if the supplied key is missing or if the types do not match.
For example, this code will get a bool value under key "key" if "key" has a boolean value in the dictionary. If there is no such key, or the value under the key is not a bool, the specified default (false) is returned.
Definition at line 517 of file dictionary.h.
bool VtDictionaryIsHolding | ( | const VtDictionary & | dictionary, |
const std::string & | key | ||
) |
Returns true if dictionary
contains key
and the corresponding value is of type T
.
Definition at line 416 of file dictionary.h.
VT_API VtDictionary VtDictionaryOver | ( | const VtDictionary & | strong, |
const VtDictionary & | weak, | ||
bool | coerceToWeakerOpinionType = false |
||
) |
Creates a dictionary containing strong
composed over weak
.
The new dictionary will contain all key-value pairs from strong
together with the key-value pairs from weak
whose keys are not in strong
.
If coerceToWeakerOpinionType
is true
then coerce a strong value to the weaker value's type, if there is a weaker value. This is mainly intended to promote to enum types.
VT_API void VtDictionaryOver | ( | VtDictionary * | strong, |
const VtDictionary & | weak, | ||
bool | coerceToWeakerOpinionType = false |
||
) |
Updates strong
to become strong
composed over weak
.
The updated contents of strong
will be all key-value pairs from strong
together with the key-value pairs from weak
whose keys are not in strong
.
If coerceToWeakerOpinionType
is true
then coerce a strong value to the weaker value's type, if there is a weaker value. This is mainly intended to promote to enum types.
VT_API void VtDictionaryOver | ( | const VtDictionary & | strong, |
VtDictionary * | weak, | ||
bool | coerceToWeakerOpinionType = false |
||
) |
Updates weak
to become strong
composed over weak
.
The updated contents of weak
will be all key-value pairs from strong
together with the key-value pairs from weak
whose keys are not in strong
.
If coerceToWeakerOpinionType
is true
then coerce a strong value to the weaker value's type, if there is a weaker value. This is mainly intended to promote to enum types.
VT_API VtDictionary VtDictionaryOverRecursive | ( | const VtDictionary & | strong, |
const VtDictionary & | weak, | ||
bool | coerceToWeakerOpinionType = false |
||
) |
Returns a dictionary containing strong
recursively composed over weak
.
The new dictionary will be all key-value pairs from strong
together with the key-value pairs from weak
whose keys are not in strong
.
If a value for a key is in turn a dictionary, and both strong and weak have values for that key, then the result may not contain strong's exact value for the subdict. Rather, the result will contain a subdict that is the result of a recursive call to this method. Hence, the subdict, too, will contain values from weak that are not found in strong.
If coerceToWeakerOpinionType
is true
then coerce a strong value to the weaker value's type, if there is a weaker value. This is mainly intended to promote to enum types.
VT_API void VtDictionaryOverRecursive | ( | VtDictionary * | strong, |
const VtDictionary & | weak, | ||
bool | coerceToWeakerOpinionType = false |
||
) |
Updates strong
to become strong
composed recursively over weak
.
The updated contents of strong
will be all key-value pairs from strong
together with the key-value pairs from weak
whose keys are not in strong
.
If a value for a key is in turn a dictionary, and both strong and weak have values for that key, then strong's subdict may not be left untouched. Rather, the dictionary will be replaced by the result of a recursive call to this method in which strong's subdictionary will have entries added if they are contained in weak but not in strong
If coerceToWeakerOpinionType
is true
then coerce a strong value to the weaker value's type, if there is a weaker value. This is mainly intended to promote to enum types.
VT_API void VtDictionaryOverRecursive | ( | const VtDictionary & | strong, |
VtDictionary * | weak, | ||
bool | coerceToWeakerOpinionType = false |
||
) |
Updates weak
to become strong
composed recursively over weak
.
The updated contents of weak
will be all key-value pairs from strong
together with the key-value pairs from weak
whose keys are not in strong
.
If a value is in turn a dictionary, the dictionary in weak may not be replaced wholesale by that of strong. Rather, the dictionary will be replaced by the result of a recursive call to this method in which weak's subdictionary is recursively overlayed by strong's subdictionary.
The result is that no key/value pairs of will be lost in nested dictionaries. Rather, only non-dictionary values will be overwritten
If coerceToWeakerOpinionType
is true
then coerce a strong value to the weaker value's type, if there is a weaker value. This is mainly intended to promote to enum types.