write_messageT_write_messageWriteMessageWriteMessagewrite_message (算子)
名称
write_messageT_write_messageWriteMessageWriteMessagewrite_message — 将消息写入文件。
签名
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)
描述
write_messagewrite_messageWriteMessageWriteMessageWriteMessagewrite_message writes the message denoted by the
MessageHandleMessageHandleMessageHandleMessageHandlemessageHandlemessage_handle to the file given by FileNameFileNameFileNameFileNamefileNamefile_name.
The default HALCON file extension for a message is 'hmsg'.
If MessageHandleMessageHandleMessageHandleMessageHandlemessageHandlemessage_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: Errors are raised and the writing process aborted.
- 'low_level'"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 FileNameFileNameFileNameFileNamefileNamefile_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""do_low_error" in set_systemset_systemSetSystemSetSystemSetSystemset_system。
- 'false'"false""false""false""false""false":
The errors are suppressed. Instead of the handle concerned an empty
handle is written in FileNameFileNameFileNameFileNamefileNamefile_name and the writing
process will be continued.
执行信息
- 多线程类型:独立(即使使用独占算子也能并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
MessageHandleMessageHandleMessageHandleMessageHandlemessageHandlemessage_handle (输入控制) message → HMessage, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Message handle.
元素数量:
MessageHandle == 1
限制:
MessageHandle != 0
FileNameFileNameFileNameFileNamefileNamefile_name (输入控制) filename.write → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
File name.
File extension:
.hmsg
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制) attribute.name(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Name of the generic parameter.
默认值:
[]
值列表:
'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 (输入控制) 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.
默认值:
[]
建议值:
'true'"true""true""true""true""true", 'false'"false""false""false""false""false", 'low_level'"low_level""low_level""low_level""low_level""low_level"
结果
如果参数有效,算子 write_messagewrite_messageWriteMessageWriteMessageWriteMessagewrite_message 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
可能的前趋
read_messageread_messageReadMessageReadMessageReadMessageread_message,
deserialize_handledeserialize_handleDeserializeHandleDeserializeHandleDeserializeHandledeserialize_handle,
create_messagecreate_messageCreateMessageCreateMessageCreateMessagecreate_message
可能的后继
read_messageread_messageReadMessageReadMessageReadMessageread_message
另见
read_messageread_messageReadMessageReadMessageReadMessageread_message,
serialize_handleserialize_handleSerializeHandleSerializeHandleSerializeHandleserialize_handle,
deserialize_handledeserialize_handleDeserializeHandleDeserializeHandleDeserializeHandledeserialize_handle
模块
基础