set_message_tupleT_set_message_tupleSetMessageTupleSetMessageTuple (Operator)

Name

set_message_tupleT_set_message_tupleSetMessageTupleSetMessageTuple — 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)

Description

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

TupleDataTupleDataTupleDataTupleDatatupleData 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_tupleSetMessageTupleSetMessageTupleSetMessageTuple and replaced by TupleDataTupleDataTupleDataTupleDatatupleData.

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_tupleGetMessageTupleGetMessageTupleGetMessageTuple.

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

This operator modifies the state of the following input parameter:

The value of this parameter may not be shared across multiple threads without external synchronization.

Parameters

MessageHandleMessageHandleMessageHandleMessageHandlemessageHandle (input_control, state is modified)  message HMessage, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Message handle.

Number of elements: MessageHandle == 1

Restriction: MessageHandle != 0

KeyKeyKeyKeykey (input_control)  string HTupleHTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Key string or integer.

Number of elements: Key == 1

TupleDataTupleDataTupleDataTupleDatatupleData (input_control)  tuple-array HTupleHTupleHtuple (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_tupleSetMessageTupleSetMessageTupleSetMessageTuple 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_messageCreateMessageCreateMessageCreateMessage

Possible Successors

enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessage, set_message_objset_message_objSetMessageObjSetMessageObjSetMessageObj

Alternatives

set_message_objset_message_objSetMessageObjSetMessageObjSetMessageObj

See also

create_messagecreate_messageCreateMessageCreateMessageCreateMessage, clear_messageclear_messageClearMessageClearMessageClearMessage, get_message_tupleget_message_tupleGetMessageTupleGetMessageTupleGetMessageTuple, set_message_objset_message_objSetMessageObjSetMessageObjSetMessageObj, get_message_objget_message_objGetMessageObjGetMessageObjGetMessageObj, set_message_paramset_message_paramSetMessageParamSetMessageParamSetMessageParam, get_message_paramget_message_paramGetMessageParamGetMessageParamGetMessageParam, enqueue_messageenqueue_messageEnqueueMessageEnqueueMessageEnqueueMessage, dequeue_messagedequeue_messageDequeueMessageDequeueMessageDequeueMessage

Module

Foundation