set_message_objT_set_message_objSetMessageObjSetMessageObjset_message_obj (Operator)
Name
set_message_objT_set_message_objSetMessageObjSetMessageObjset_message_obj
— Add a key/object pair to the message.
Signature
Description
set_message_objset_message_objSetMessageObjSetMessageObjSetMessageObjset_message_obj
stores an object associated with a key in the
message, which behaves as a dictionary-like data container.
The message is denoted by the MessageHandleMessageHandleMessageHandleMessageHandlemessageHandlemessage_handle
parameter.
ObjectDataObjectDataObjectDataObjectDataobjectDataobject_data
is copied by the operation (copying the object data
in HALCON's object database, see copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj
), and can thus be
immediately reused. Both an empty object or an object tuple are considered
as a valid value that can be associated with the key.
If any data (tuple or object) was already associated with given key
(KeyKeyKeyKeykeykey
), the old data is destroyed by set_message_objset_message_objSetMessageObjSetMessageObjSetMessageObjset_message_obj
and replaced by ObjectDataObjectDataObjectDataObjectDataobjectDataobject_data
.
The KeyKeyKeyKeykeykey
has to be a string or an integer.
String keys are treated case sensitive.
The object data for the given key can be retrieved again from the message
using get_message_objget_message_objGetMessageObjGetMessageObjGetMessageObjget_message_obj
.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
This operator modifies the state of the following input parameter:
During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.
Parameters
ObjectDataObjectDataObjectDataObjectDataobjectDataobject_data
(input_object) object(-array) →
objectHObjectHObjectHObjectHobject
Object to be associated with the key.
MessageHandleMessageHandleMessageHandleMessageHandlemessageHandlemessage_handle
(input_control, state is modified) message →
HMessage, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Message handle.
Number of elements:
MessageHandle == 1
Restriction:
MessageHandle != 0
KeyKeyKeyKeykeykey
(input_control) string →
HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)
Key string or integer.
Number of elements:
Key == 1
Example (HDevelop)
create_message (Message)
read_image( Image, 'filename')
set_message_obj (Image, Message, 'my_image')
Result
If the operation succeeds, set_message_tupleset_message_tupleSetMessageTupleSetMessageTupleSetMessageTupleset_message_tuple
returns 2 (
H_MSG_TRUE)
.
Otherwise an exception is raised. Possible error conditions include
invalid parameters (handle or key) or resource allocation error.
Possible Predecessors
create_messagecreate_messageCreateMessageCreateMessageCreateMessagecreate_message
Possible Successors
enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessageenqueue_message
,
set_message_tupleset_message_tupleSetMessageTupleSetMessageTupleSetMessageTupleset_message_tuple
Alternatives
set_message_tupleset_message_tupleSetMessageTupleSetMessageTupleSetMessageTupleset_message_tuple
See also
create_messagecreate_messageCreateMessageCreateMessageCreateMessagecreate_message
,
clear_messageclear_messageClearMessageClearMessageClearMessageclear_message
,
set_message_tupleset_message_tupleSetMessageTupleSetMessageTupleSetMessageTupleset_message_tuple
,
get_message_tupleget_message_tupleGetMessageTupleGetMessageTupleGetMessageTupleget_message_tuple
,
get_message_objget_message_objGetMessageObjGetMessageObjGetMessageObjget_message_obj
,
set_message_paramset_message_paramSetMessageParamSetMessageParamSetMessageParamset_message_param
,
get_message_paramget_message_paramGetMessageParamGetMessageParamGetMessageParamget_message_param
,
enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessageenqueue_message
,
dequeue_messagedequeue_messageDequeueMessageDequeueMessageDequeueMessagedequeue_message
Module
Foundation