get_dict_tupleT_get_dict_tupleGetDictTupleGetDictTupleget_dict_tuple (算子)
名称
get_dict_tupleT_get_dict_tupleGetDictTupleGetDictTupleget_dict_tuple — 从字典中检索与键关联的元组。
签名
def get_dict_tuple(dict_handle: HHandle, key: MaybeSequence[Union[str, int]]) -> Sequence[Union[int, float, str]]
def get_dict_tuple_s(dict_handle: HHandle, key: MaybeSequence[Union[str, int]]) -> Union[int, float, str]
描述
get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple retrieves a tuple associated with the KeyKeyKeyKeykeykey
from the dictionary denoted by the DictHandleDictHandleDictHandleDictHandledictHandledict_handle.
The tuple has to be previously stored to the dictionary using
set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple。
The operator returns the data in the parameter TupleTupleTupleTupletupletuple.
The data including strings is copied by the operation, the dictionary can
thus be immediately reused.
If the given KeyKeyKeyKeykeykey is not present in the dictionary or if the data
associated with the key is not a tuple, get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple fails.
Presence of keys and information about the data associated with the key
can be verified using get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParamget_dict_param。
Obtaining the values for multiple keys at once is only possible if for each
of those keys, the dictionary contains a tuple with a single element.
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
DictHandleDictHandleDictHandleDictHandledictHandledict_handle (输入控制) dict → HDict, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Dictionary handle.
元素数量:
DictHandle == 1
KeyKeyKeyKeykeykey (输入控制) string(-array) → HTupleMaybeSequence[Union[str, int]]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)
Key string.
TupleTupleTupleTupletupletuple (输出控制) tuple(-array) → HTupleSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)
Tuple value retrieved from the dictionary.
示例(HDevelop)
* ...
get_dict_param (Dict, 'key_exists', ['simple_string','foo','my_image'], \
KeysPresence)
get_dict_param (Dict, 'key_data_type', ['simple_string','my_image'], \
KeysType)
get_dict_tuple (Dict, 'simple_string', TupleString)
*
* Access multiple keys, if their tuple all have length 1
get_dict_tuple (Dict, ['key1','key2','key3'], MultipleValues)
结果
If the operation succeeds, get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple 返回 2 ( H_MSG_TRUE )。否则将抛出异常。 Possible error conditions include
invalid parameters (handle or key), the required key not found in the
dictionary, or other than tuple data associated with given key.
可能的前趋
set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple
可能的后继
get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple,
set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple,
set_dict_tuple_atset_dict_tuple_atSetDictTupleAtSetDictTupleAtSetDictTupleAtset_dict_tuple_at
替代
get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObjectget_dict_object
另见
create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict,
set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple,
set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObjectset_dict_object,
get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObjectget_dict_object,
remove_dict_keyremove_dict_keyRemoveDictKeyRemoveDictKeyRemoveDictKeyremove_dict_key,
get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParamget_dict_param
模块
基础