Skip to content

get_dict_tupleGetDictTupleGetDictTupleget_dict_tupleT_get_dict_tuple🔗

Short description🔗

get_dict_tupleGetDictTupleGetDictTupleget_dict_tupleT_get_dict_tuple — Retrieve a tuple associated with the key from the dictionary.

Signature🔗

get_dict_tuple( dict DictHandle, string Key, out tuple Tuple )void GetDictTuple( const HTuple& DictHandle, const HTuple& Key, HTuple* Tuple )static void HOperatorSet.GetDictTuple( HTuple dictHandle, HTuple key, out HTuple 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]Herror T_get_dict_tuple( const Htuple DictHandle, const Htuple Key, Htuple* Tuple )

HTuple HDict::GetDictTuple( const HTuple& Key ) const

HTuple HDict::GetDictTuple( const HString& Key ) const

HTuple HDict::GetDictTuple( const char* Key ) const

HTuple HDict::GetDictTuple( const wchar_t* Key ) const (Windows only)

HTuple HDict.GetDictTuple( HTuple key )

HTuple HDict.GetDictTuple( string key )

Description🔗

get_dict_tupleGetDictTuple retrieves a tuple associated with the Keykeykey from the dictionary denoted by the DictHandledictHandledict_handle. The tuple has to be previously stored to the dictionary using set_dict_tupleSetDictTuple.

The operator returns the data in the parameter Tupletupletuple. The data including strings is copied by the operation, the dictionary can thus be immediately reused.

If the given Keykeykey is not present in the dictionary or if the data associated with the key is not a tuple, get_dict_tupleGetDictTuple fails. Presence of keys and information about the data associated with the key can be verified using get_dict_paramGetDictParam.

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.

HDevelop In-line Operation🔗

HDevelop provides an in-line operation for get_dict_tupleGetDictTuple, which can be used in an expression in the following syntax:

  • Dynamic syntax:

    Tuple := DictHandle.['Key']

  • Static syntax:

    Tuple := DictHandle.Key

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

DictHandledictHandledict_handle (input_control) dict → (handle)HTuple (HHandle)HDict, HTuple (IntPtr)HHandleHtuple (handle)

Dictionary handle.

Number of elements: DictHandle == 1

Keykeykey (input_control) string(-array) → (string / integer)HTuple (HString / Hlong)HTuple (string / int / long)MaybeSequence[Union[str, int]]Htuple (char* / Hlong)

Key string.

Tupletupletuple (output_control) tuple(-array) → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)Sequence[Union[int, float, str]]Htuple (char* / Hlong / double)

Tuple value retrieved from the dictionary.

Example🔗

(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)

Result🔗

If the operation succeeds, get_dict_tupleGetDictTuple returns 2 (H_MSG_TRUE). Otherwise an exception is raised. 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.

Combinations with other operators🔗

Combinations

Possible predecessors

set_dict_tupleSetDictTuple

Possible successors

get_dict_tupleGetDictTuple, set_dict_tupleSetDictTuple, set_dict_tuple_atSetDictTupleAt

Alternatives

get_dict_objectGetDictObject

See also

create_dictCreateDict, set_dict_tupleSetDictTuple, set_dict_objectSetDictObject, get_dict_objectGetDictObject, remove_dict_keyRemoveDictKey, get_dict_paramGetDictParam

Module🔗

Foundation