write_dictT_write_dictWriteDictWriteDictwrite_dict (Operator)

Name

write_dictT_write_dictWriteDictWriteDictwrite_dict — Write a dictionary to a file.

Signature

write_dict( : : DictHandle, FileName, GenParamName, GenParamValue : )

Herror T_write_dict(const Htuple DictHandle, const Htuple FileName, const Htuple GenParamName, const Htuple GenParamValue)

void WriteDict(const HTuple& DictHandle, const HTuple& FileName, const HTuple& GenParamName, const HTuple& GenParamValue)

void HDict::WriteDict(const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue) const

void HDict::WriteDict(const HString& FileName, const HString& GenParamName, const HString& GenParamValue) const

void HDict::WriteDict(const char* FileName, const char* GenParamName, const char* GenParamValue) const

void HDict::WriteDict(const wchar_t* FileName, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   (Windows only)

static void HOperatorSet.WriteDict(HTuple dictHandle, HTuple fileName, HTuple genParamName, HTuple genParamValue)

void HDict.WriteDict(string fileName, HTuple genParamName, HTuple genParamValue)

void HDict.WriteDict(string fileName, string genParamName, string genParamValue)

def write_dict(dict_handle: HHandle, file_name: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]]) -> None

Description

write_dictwrite_dictWriteDictWriteDictWriteDictwrite_dict writes the dictionary denoted by the DictHandleDictHandleDictHandleDictHandledictHandledict_handle to the file FileNameFileNameFileNameFileNamefileNamefile_name. The file is written as 'hdict', the HALCON format for dictionaries. The default HALCON file extension for a dictionary is 'hdict'.

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

'true'"true""true""true""true""true":

The default behavior, errors are raised.

'false'"false""false""false""false""false":

The errors are suppressed, empty handles are written in place of the non serializable handles.

'low_level'"low_level""low_level""low_level""low_level""low_level":

Only low level errors are raised containing the handles in question. Empty handles are written in place of the non serializable handles. The behavior regarding HALCON low level errors is determined by 'do_low_error'"do_low_error""do_low_error""do_low_error""do_low_error""do_low_error" in set_systemset_systemSetSystemSetSystemSetSystemset_system.

Execution Information

Parameters

DictHandleDictHandleDictHandleDictHandledictHandledict_handle (input_control)  dict HDict, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Dictionary handle.

Number of elements: DictHandle == 1

FileNameFileNameFileNameFileNamefileNamefile_name (input_control)  filename.write HTuplestrHTupleHtuple (string) (string) (HString) (char*)

File name.

File extension: .hdict

GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (input_control)  attribute.name(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Name of the generic parameter.

Default value: []

List of values: 'raise_error_if_content_not_serializable'"raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable""raise_error_if_content_not_serializable"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (input_control)  attribute.name(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Value of the generic parameter.

Default value: []

Suggested values: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false", 'low_level'"low_level""low_level""low_level""low_level""low_level"

Result

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

Possible Predecessors

read_dictread_dictReadDictReadDictReadDictread_dict, deserialize_handledeserialize_handleDeserializeHandleDeserializeHandleDeserializeHandledeserialize_handle, create_dictcreate_dictCreateDictCreateDictCreateDictcreate_dict

Possible Successors

read_dictread_dictReadDictReadDictReadDictread_dict

See also

read_dictread_dictReadDictReadDictReadDictread_dict, serialize_handleserialize_handleSerializeHandleSerializeHandleSerializeHandleserialize_handle, deserialize_handledeserialize_handleDeserializeHandleDeserializeHandleDeserializeHandledeserialize_handle

Module

Foundation