set_dict_tupleT_set_dict_tupleSetDictTupleSetDictTupleset_dict_tuple (Operator)

Name

set_dict_tupleT_set_dict_tupleSetDictTupleSetDictTupleset_dict_tuple — Add a key/tuple pair to the dictionary.

Signature

set_dict_tuple( : : DictHandle, Key, Tuple : )

Herror T_set_dict_tuple(const Htuple DictHandle, const Htuple Key, const Htuple Tuple)

void SetDictTuple(const HTuple& DictHandle, const HTuple& Key, const HTuple& Tuple)

void HDict::SetDictTuple(const HTuple& Key, const HTuple& Tuple) const

void HDict::SetDictTuple(const HString& Key, const HTuple& Tuple) const

void HDict::SetDictTuple(const char* Key, const HTuple& Tuple) const

void HDict::SetDictTuple(const wchar_t* Key, const HTuple& Tuple) const   (Windows only)

static void HOperatorSet.SetDictTuple(HTuple dictHandle, HTuple key, HTuple tuple)

void HDict.SetDictTuple(HTuple key, HTuple tuple)

void HDict.SetDictTuple(string key, HTuple tuple)

def set_dict_tuple(dict_handle: HHandle, key: Union[str, int], tuple: Sequence[Union[int, float, str]]) -> None

Description

set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple stores a tuple associated with a key in the dictionary. The dictionary is denoted by the DictHandleDictHandleDictHandleDictHandledictHandledict_handle parameter.

TupleTupleTupleTupletupletuple including strings is copied by the operation, and can thus be immediately reused. An empty tuple is considered as a valid value that can be associated with the key. If any data (tuple or object) was already associated with given key (KeyKeyKeyKeykeykey), the old data is destroyed by set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple and replaced by TupleTupleTupleTupletupletuple.

The KeyKeyKeyKeykeykey has to be a string or an integer. Strings are treated case sensitive.

The tuple data for the given key can be retrieved again from the dictionary using get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple.

Attention

Note that if the tuple contains any handles (which are treated as simple integers) only the handle values are copied by the operation, not the resources behind those handles.

Execution Information

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters

DictHandleDictHandleDictHandleDictHandledictHandledict_handle (input_control, state is modified)  dict HDict, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Dictionary handle.

Number of elements: DictHandle == 1

KeyKeyKeyKeykeykey (input_control)  string HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Key string.

Number of elements: Key == 1

Restriction: length(Key) > 0

TupleTupleTupleTupletupletuple (input_control)  tuple-array HTupleSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Tuple value to be associated with the key.

Example (HDevelop)

create_dict (Dict)
set_dict_tuple (Dict, 'simple_integer', 27)
set_dict_tuple (Dict, 'simple_string', 'Hello world')
set_dict_tuple (Dict, 'mixed_tuple', ['The answer', 42])
set_dict_tuple (Dict, 0, 'This is zero')

Result

If the operation succeeds, set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple returns TRUE. Otherwise an exception is raised. Possible error conditions include invalid parameters (handle or key) or resource allocation error.

Possible Predecessors

create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict

Possible Successors

set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple, set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObjectset_dict_object

Alternatives

set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObjectset_dict_object

See also

create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict, get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple, set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObjectset_dict_object, get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObjectget_dict_object, get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParamget_dict_param, remove_dict_keyremove_dict_keyRemoveDictKeyRemoveDictKeyRemoveDictKeyremove_dict_key

Module

Foundation