Skip to content

copy_dictCopyDictCopyDictcopy_dictT_copy_dict🔗

Short description🔗

copy_dictCopyDictCopyDictcopy_dictT_copy_dict — Copy a dictionary.

Signature🔗

copy_dict( dict DictHandle, attribute.name GenParamName, attribute.name GenParamValue, out dict CopiedDictHandle )void CopyDict( const HTuple& DictHandle, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* CopiedDictHandle )static void HOperatorSet.CopyDict( HTuple dictHandle, HTuple genParamName, HTuple genParamValue, out HTuple copiedDictHandle )def copy_dict( dict_handle: HHandle, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_copy_dict( const Htuple DictHandle, const Htuple GenParamName, const Htuple GenParamValue, Htuple* CopiedDictHandle )

HDict HDict::CopyDict( const HTuple& GenParamName, const HTuple& GenParamValue ) const

HDict HDict::CopyDict( const HString& GenParamName, const HString& GenParamValue ) const

HDict HDict::CopyDict( const char* GenParamName, const char* GenParamValue ) const

HDict HDict::CopyDict( const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

HDict HDict.CopyDict( HTuple genParamName, HTuple genParamValue )

HDict HDict.CopyDict( string genParamName, string genParamValue )

Description🔗

copy_dictCopyDict creates a deep copy (i.e., all contained handles and iconic objects are deep copied) of the dictionary DictHandledictHandledict_handle in the dictionary CopiedDictHandlecopiedDictHandlecopied_dict_handle.

If DictHandledictHandledict_handle contains a handle that can not be copied or that has been freed already, an exception is raised per default. This behavior is controlled by GenParamNamegenParamNamegen_param_name 'raise_error_if_content_not_serializable'"raise_error_if_content_not_serializable", and the corresponding GenParamValuegenParamValuegen_param_value can take the following values:

  • 'true'"true": The default: Errors are raised and the copy process aborted.

  • 'low_level'"low_level": Only low level errors are raised. Instead of the handle concerned an empty handle is copied in CopiedDictHandlecopiedDictHandlecopied_dict_handle and the copy process will be continued. The behavior regarding HALCON low level errors is determined by 'do_low_error'"do_low_error" in set_systemSetSystem.

  • 'false'"false": The errors are suppressed. Instead of the handle concerned an empty handle is copied in CopiedDictHandlecopiedDictHandlecopied_dict_handle and the copy process will be continued.

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

GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Name of the generic parameter.

Default: [][]
List of values: 'raise_error_if_content_not_serializable'"raise_error_if_content_not_serializable"

GenParamValuegenParamValuegen_param_value (input_control) attribute.name(-array) → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)MaybeSequence[Union[int, float, str]]Htuple (char* / Hlong / double)

Value of the generic parameter.

Default: [][]
Suggested values: 'true', 'false', 'low_level'"true", "false", "low_level"

CopiedDictHandlecopiedDictHandlecopied_dict_handle (output_control) dict → (handle)HTuple (HHandle)HDict, HTuple (IntPtr)HHandleHtuple (handle)

Copied dictionary handle.

Number of elements: CopiedDictHandle == 1

Result🔗

If the parameters are valid, the operator copy_dictCopyDict returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

read_dictReadDict, deserialize_handleDeserializeHandle, create_dictCreateDict

Possible successors

write_dictWriteDict

See also

read_dictReadDict, write_dictWriteDict, serialize_handleSerializeHandle, deserialize_handleDeserializeHandle

Module🔗

Foundation