set_dict_objectπ
Short descriptionπ
set_dict_object β Add a key/object pair to the dictionary.
Signatureπ
set_dict_object( object Object, dict DictHandle, string Key )
Descriptionπ
set_dict_object stores an object associated with a key in the
dictionary.
The dictionary is denoted by the DictHandle parameter.
Object is copied by the operation and can thus be
immediately reused.
Thereby the object data is copied in HALCONβs object database,
meaning the new object contains a reference to Object,
see copy_obj.
Both an empty object or an object tuple are considered
as a valid value that can be associated with the key.
If any data (tuple or object) was already associated with given key
(Key), the old data is destroyed by set_dict_object
and replaced by Object.
The Key has to be a string or an integer.
Strings are treated case sensitive.
The object data for the given key can be retrieved again from the dictionary
using get_dict_object.
HDevelop In-line Operationπ
HDevelop provides an in-line operation for set_dict_object,
which can be used in an expression in the following syntax:
-
Dynamic syntax:
DictHandle.['Key'] := Object -
Static syntax:
DictHandle.Key := Object
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.
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π
Object (input_object) object(-array) β object
Object to be associated with the key.
DictHandle (input_control, state is modified) dict β (handle)
Dictionary handle.
Number of elements: DictHandle == 1
Key (input_control) string β (string / integer)
Key string.
Number of elements: Key == 1
Restriction: length(Key) > 0
Exampleπ
(HDevelop)
Resultπ
If the operation succeeds, set_dict_object returns 2 (H_MSG_TRUE).
Otherwise an exception is raised. Possible error conditions include
invalid parameters (handle or key) or resource allocation error.
Combinations with other operatorsπ
Combinations
Possible predecessors
Possible successors
set_dict_object, set_dict_tuple
Alternatives
See also
create_dict, set_dict_tuple, get_dict_tuple, get_dict_object, remove_dict_key, get_dict_param
Moduleπ
Foundation