set_dict_tuple_atT_set_dict_tuple_atSetDictTupleAtSetDictTupleAtset_dict_tuple_at (Operator)

Name

set_dict_tuple_atT_set_dict_tuple_atSetDictTupleAtSetDictTupleAtset_dict_tuple_at — Assignment of one or several values to one or several tuple elements in a dictionary

Signature

set_dict_tuple_at( : : DictHandle, Key, Index, Value : )

Herror T_set_dict_tuple_at(const Htuple DictHandle, const Htuple Key, const Htuple Index, const Htuple Value)

void SetDictTupleAt(const HTuple& DictHandle, const HTuple& Key, const HTuple& Index, const HTuple& Value)

void HDict::SetDictTupleAt(const HTuple& Key, const HTuple& Index, const HTuple& Value) const

void HDict::SetDictTupleAt(const HString& Key, const HTuple& Index, const HTuple& Value) const

void HDict::SetDictTupleAt(const char* Key, const HTuple& Index, const HTuple& Value) const

void HDict::SetDictTupleAt(const wchar_t* Key, const HTuple& Index, const HTuple& Value) const   (Windows only)

static void HOperatorSet.SetDictTupleAt(HTuple dictHandle, HTuple key, HTuple index, HTuple value)

void HDict.SetDictTupleAt(HTuple key, HTuple index, HTuple value)

void HDict.SetDictTupleAt(string key, HTuple index, HTuple value)

def set_dict_tuple_at(dict_handle: HHandle, key: Union[str, int], index: Sequence[int], value: Sequence[HTupleElementType]) -> None

Description

set_dict_tuple_atset_dict_tuple_atSetDictTupleAtSetDictTupleAtSetDictTupleAtset_dict_tuple_at assigns a single value to one or several elements of a tuple, or it assigns a number of values elementwise to the specified elements of a tuple that is stored in DictHandleDictHandleDictHandleDictHandledictHandledict_handle under the key KeyKeyKeyKeykeykey. The operator allows to efficiently replace parts of a tuple stored in a dictionary without first reading the previous values from the dictionary.

If the dictionary does not yet contain a tuple under the given key, or if the given key maps to an iconic value, a new tuple is created and stored under the given key. In the latter case, the iconic object previously stored under that key is removed from the dictionary.

If the passed indices are out of the current range of the tuple stored in the dictionary, the tuple length is increased and the new values are initialized to a default value.

The KeyKeyKeyKeykeykey has to be a string or an integer. Strings are treated case sensitive. The IndexIndexIndexIndexindexindex parameter can be any expression that evaluates to any number of positive integer values. The ValueValueValueValuevaluevalue parameter must evaluate to exactly one value or to the same number of indices that are provided via the IndexIndexIndexIndexindexindex parameter.:

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 ValueValueValueValuevaluevalue contains any handles, 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

IndexIndexIndexIndexindexindex (input_control)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Indices of the elements that have to be replaced by the new value(s).

Default value: 0

Suggested values: 0, 1, 2, 3, 4, 5, 6

Minimum increment: 1

ValueValueValueValuevaluevalue (input_control)  tuple-array HTupleSequence[HTupleElementType]HTupleHtuple (string / integer / real / handle) (string / int / long / double / HHandle) (HString / Hlong / double / HHandle) (char* / Hlong / double / handle)

Value(s) that is to be assigned.

Example (HDevelop)

Dict := dict{}
Dict.some_key := 27

set_dict_tuple_at (Dict, 'some_key', 1, 5)
* Dict.some_key is now [27, 5]

* Alternative TRIAS syntax
Dict.some_key[0] := 66
* Dict.some_key is now [66, 5]

Result

If the operation succeeds, set_dict_tuple_atset_dict_tuple_atSetDictTupleAtSetDictTupleAtSetDictTupleAtset_dict_tuple_at returns 2 (H_MSG_TRUE). Otherwise an exception is raised. Possible error conditions include invalid parameters or resource allocation error.

Possible Predecessors

create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict

Possible Successors

set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple, get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTupleget_dict_tuple

Alternatives

set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple

See also

create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict, set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTupleset_dict_tuple, 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