create_dictT_create_dictCreateDictCreateDict (Operator)

Name

create_dictT_create_dictCreateDictCreateDict — Create a new empty dictionary.

Signature

create_dict( : : : DictHandle)

Herror T_create_dict(Htuple* DictHandle)

void CreateDict(HTuple* DictHandle)

void HDict::HDict()

void HDict::CreateDict()

static void HOperatorSet.CreateDict(out HTuple dictHandle)

public HDict()

void HDict.CreateDict()

Description

create_dictcreate_dictCreateDictCreateDictCreateDict creates a new empty dictionary and returns it in DictHandleDictHandleDictHandleDictHandledictHandle.

The dictionary serves as an associative array-like container allowing to store an arbitrary number of values associated with unique keys (integers or strings). Each key can refer either to a tuple or to an iconic object. These are stored in the dictionary using set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTuple or set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObject, respectively, from where they can be retrieved again using get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTuple or get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObject.

The data stored in the dictionary is always a copy of the original data, being it control parameters or objects. The original data can thus be reused immediately after the set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTuple or set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObject calls without affecting the dictionary. Notable exceptions are handles which are treated as regular integer values by HALCON, therefore storing any handle in the dictionary will copy the handle value, but not the resource behind the handle.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters

DictHandleDictHandleDictHandleDictHandledictHandle (output_control)  dict HDict, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the newly created dictionary.

Number of elements: DictHandle == 1

Example (HDevelop)

Dicts := []
for idx := 0 to 4 by 1
  create_dict (DictHandle)
  Dicts[idx] := DictHandle
endfor
* ...

Result

Returns 2 (H_MSG_TRUE) unless a resource allocation error occurs.

Possible Successors

set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTuple, set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObject

See also

set_dict_tupleset_dict_tupleSetDictTupleSetDictTupleSetDictTuple, get_dict_tupleget_dict_tupleGetDictTupleGetDictTupleGetDictTuple, set_dict_objectset_dict_objectSetDictObjectSetDictObjectSetDictObject, get_dict_objectget_dict_objectGetDictObjectGetDictObjectGetDictObject, get_dict_paramget_dict_paramGetDictParamGetDictParamGetDictParam

Module

Foundation