write_messageT_write_messageWriteMessageWriteMessagewrite_message (Operator)

Name

write_messageT_write_messageWriteMessageWriteMessagewrite_message — Write a message to a file.

Signature

write_message( : : MessageHandle, FileName, GenParamName, GenParamValue : )

Herror T_write_message(const Htuple MessageHandle, const Htuple FileName, const Htuple GenParamName, const Htuple GenParamValue)

void WriteMessage(const HTuple& MessageHandle, const HTuple& FileName, const HTuple& GenParamName, const HTuple& GenParamValue)

void HMessage::WriteMessage(const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue) const

void HMessage::WriteMessage(const HString& FileName, const HString& GenParamName, const HString& GenParamValue) const

void HMessage::WriteMessage(const char* FileName, const char* GenParamName, const char* GenParamValue) const

void HMessage::WriteMessage(const wchar_t* FileName, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

static void HOperatorSet.WriteMessage(HTuple messageHandle, HTuple fileName, HTuple genParamName, HTuple genParamValue)

void HMessage.WriteMessage(string fileName, HTuple genParamName, HTuple genParamValue)

void HMessage.WriteMessage(string fileName, string genParamName, string genParamValue)

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

Description

write_messagewrite_messageWriteMessageWriteMessagewrite_message writes the message denoted by the MessageHandleMessageHandleMessageHandlemessageHandlemessage_handle to the file given by FileNameFileNameFileNamefileNamefile_name. The default HALCON file extension for a message is 'hmsg'.

If MessageHandleMessageHandleMessageHandlemessageHandlemessage_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 GenParamNameGenParamNameGenParamNamegenParamNamegen_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", and the corresponding GenParamValueGenParamValueGenParamValuegenParamValuegen_param_value can take the following values:

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

The default: Errors are raised and the writing process aborted.

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

Only low level errors are raised. Instead of the handle concerned an empty handle is written in FileNameFileNameFileNamefileNamefile_name and the writing process will be continued. 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" in set_systemset_systemSetSystemSetSystemset_system.

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

The errors are suppressed. Instead of the handle concerned an empty handle is written in FileNameFileNameFileNamefileNamefile_name and the writing process will be continued.

Execution Information

Parameters

MessageHandleMessageHandleMessageHandlemessageHandlemessage_handle (input_control)  message HMessage, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Message handle.

Number of elements: MessageHandle == 1

Restriction: MessageHandle != 0

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

File name.

File extension: .hmsg

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

Name of the generic parameter.

Default: []

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"

GenParamValueGenParamValueGenParamValuegenParamValuegen_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: []

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

Result

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

Possible Predecessors

read_messageread_messageReadMessageReadMessageread_message, deserialize_handledeserialize_handleDeserializeHandleDeserializeHandledeserialize_handle, create_messagecreate_messageCreateMessageCreateMessagecreate_message

Possible Successors

read_messageread_messageReadMessageReadMessageread_message

See also

read_messageread_messageReadMessageReadMessageread_message, serialize_handleserialize_handleSerializeHandleSerializeHandleserialize_handle, deserialize_handledeserialize_handleDeserializeHandleDeserializeHandledeserialize_handle

Module

Foundation