Operator Reference

set_message_tupleT_set_message_tupleSetMessageTupleSetMessageTupleset_message_tuple (Operator)

set_message_tupleT_set_message_tupleSetMessageTupleSetMessageTupleset_message_tuple — Add a key/tuple pair to the message.

Signature

set_message_tuple( : : MessageHandle, Key, TupleData : )

Herror T_set_message_tuple(const Htuple MessageHandle, const Htuple Key, const Htuple TupleData)

void SetMessageTuple(const HTuple& MessageHandle, const HTuple& Key, const HTuple& TupleData)

void HMessage::SetMessageTuple(const HTuple& Key, const HTuple& TupleData) const

void HMessage::SetMessageTuple(const HString& Key, const HTuple& TupleData) const

void HMessage::SetMessageTuple(const char* Key, const HTuple& TupleData) const

void HMessage::SetMessageTuple(const wchar_t* Key, const HTuple& TupleData) const   ( Windows only)

static void HOperatorSet.SetMessageTuple(HTuple messageHandle, HTuple key, HTuple tupleData)

void HMessage.SetMessageTuple(HTuple key, HTuple tupleData)

void HMessage.SetMessageTuple(string key, HTuple tupleData)

def set_message_tuple(message_handle: HHandle, key: Union[str, int], tuple_data: Sequence[HTupleElementType]) -> None

Description

set_message_tupleset_message_tupleSetMessageTupleSetMessageTupleset_message_tuple stores a tuple associated with a key in the message, which behaves as a dictionary-like data container. The message is denoted by the MessageHandleMessageHandleMessageHandlemessageHandlemessage_handle parameter.

TupleDataTupleDataTupleDatatupleDatatuple_data including strings is copied by the operation, and can thus be immediately reused. An empty tuple is considered as a valid value that can be associated with the key. If any data (tuple or object) was already associated with given key (KeyKeyKeykeykey), the old data is destroyed by set_message_tupleset_message_tupleSetMessageTupleSetMessageTupleset_message_tuple and replaced by TupleDataTupleDataTupleDatatupleDatatuple_data.

The KeyKeyKeykeykey has to be a string or an integer. String keys are treated case sensitive.

The tuple data for the given key can be retrieved again from the message using get_message_tupleget_message_tupleGetMessageTupleGetMessageTupleget_message_tuple.

Attention

Note that if the tuple contains any handles (which are treated as simple integers) only the handle values are copied by the operation, not the resources behind those handles.

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

MessageHandleMessageHandleMessageHandlemessageHandlemessage_handle (input_control, state is modified)  message HMessage, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Message handle.

Number of elements: MessageHandle == 1

Restriction: MessageHandle != 0

KeyKeyKeykeykey (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

TupleDataTupleDataTupleDatatupleDatatuple_data (input_control)  tuple-array HTupleSequence[HTupleElementType]HTupleHtuple (string / integer / real / handle) (string / int / long / double / HHandle) (HString / Hlong / double / HHandle) (char* / Hlong / double / handle)

Tuple value to be associated with the key.

Example (HDevelop)

create_message (Message)
set_message_tuple (Message, 'simple_integer', 27)
set_message_tuple (Message, 'simple_string', 'Hello world')
set_message_tuple (Message, 'mixed_tuple', ['The answer', 42])

Result

If the operation succeeds, set_message_tupleset_message_tupleSetMessageTupleSetMessageTupleset_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_messageCreateMessageCreateMessagecreate_message

Possible Successors

enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageenqueue_message, set_message_objset_message_objSetMessageObjSetMessageObjset_message_obj

Alternatives

set_message_objset_message_objSetMessageObjSetMessageObjset_message_obj

See also

create_messagecreate_messageCreateMessageCreateMessagecreate_message, clear_messageclear_messageClearMessageClearMessageclear_message, get_message_tupleget_message_tupleGetMessageTupleGetMessageTupleget_message_tuple, set_message_objset_message_objSetMessageObjSetMessageObjset_message_obj, get_message_objget_message_objGetMessageObjGetMessageObjget_message_obj, set_message_paramset_message_paramSetMessageParamSetMessageParamset_message_param, get_message_paramget_message_paramGetMessageParamGetMessageParamget_message_param, enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageenqueue_message, dequeue_messagedequeue_messageDequeueMessageDequeueMessagedequeue_message

Module

Foundation