Template representing a destination to which a message should be sent. More...
#include <UTMessageDestination.h>
Public Member Functions | |
MessageDestination_t () | |
MessageDestination_t (MessageLoop_t *message_loop, Task_t *task, MessageTypeReceiver_t< MESSAGE_TYPE > *receiver) | |
const MessageDestination_t < MESSAGE_TYPE > & | operator= (const MessageDestination_t< MESSAGE_TYPE > ©) |
bool | IsValid () const |
void | Invalidate () |
MessageLoop_t * | MessageLoop () const |
void | SendMessage (const MESSAGE_TYPE &message, const MessageLoop_t *sent_from_context) const |
void | SendMessageAsync (takes MESSAGE_TYPE *message) const |
void | SendMessageAsync (const MESSAGE_TYPE &message) const |
Template representing a destination to which a message should be sent. This object is thread safe in that if the destination is deleted before the message source has been informed about the destination having been deleted, any messages will be properly disposed of. See MessageLoop_t for a comprehensive explanation of the UT messaging architecture.
Definition at line 87 of file UTMessageDestination.h.
MessageDestination_t< MESSAGE_TYPE >::MessageDestination_t | ( | ) | [inline] |
Constructor for an invalid message destination.
Definition at line 238 of file UTMessageDestination.h.
MessageDestination_t< MESSAGE_TYPE >::MessageDestination_t | ( | MessageLoop_t * | message_loop, | |
Task_t * | task, | |||
MessageTypeReceiver_t< MESSAGE_TYPE > * | receiver | |||
) | [inline] |
Constructor for an object representing a destination to which a message should be sent. This object is thread safe in that if the destination is deleted before the message source has been informed about the destination having been deleted, any messages will be properly disposed of.
Definition at line 245 of file UTMessageDestination.h.
const MessageDestination_t< MESSAGE_TYPE > & MessageDestination_t< MESSAGE_TYPE >::operator= | ( | const MessageDestination_t< MESSAGE_TYPE > & | copy | ) | [inline] |
Assignment operator.
Definition at line 255 of file UTMessageDestination.h.
bool MessageDestination_t< MESSAGE_TYPE >::IsValid | ( | ) | const [inline] |
Returns true if the message destination is valid. This doesn't actually check whether the "real" destination is valid, because if it returned true, that could stop being the case before the caller could act on it. All that this function checks is whether the local MessageDestination_t object has been assigned a target.
Definition at line 264 of file UTMessageDestination.h.
void MessageDestination_t< MESSAGE_TYPE >::Invalidate | ( | ) | [inline] |
Clears all destination information.
Definition at line 272 of file UTMessageDestination.h.
MessageLoop_t * MessageDestination_t< MESSAGE_TYPE >::MessageLoop | ( | ) | const [inline] |
Returns a pointer to the target message loop. Once the message loop is running, the returned pointer can't be used for much since it can't be guaranteed to still exist unless it is being used in a way guaranteed to be executed from the same message loop.
Definition at line 280 of file UTMessageDestination.h.
void MessageDestination_t< MESSAGE_TYPE >::SendMessage | ( | const MESSAGE_TYPE & | message, | |
const MessageLoop_t * | sent_from_context | |||
) | const [inline] |
Sends a message. If the destination is in the same message loop in which the caller is running (based on sent_from_context), the receiver function is actually called directly from inside this function rather than being cloned and queued in the target message loop. If sent_from_context is NULL, the message is sent asynchronously. If atomic processing of this message is needed, use SendMessageAsync instead.
Definition at line 288 of file UTMessageDestination.h.
void MessageDestination_t< MESSAGE_TYPE >::SendMessageAsync | ( | takes MESSAGE_TYPE * | message | ) | const [inline] |
Sends a message asynchronously, being queued to the message loop which is targeted by the destination. The target message loop or destination takes posession of and responsibility for deleting the message.
Definition at line 297 of file UTMessageDestination.h.
void MessageDestination_t< MESSAGE_TYPE >::SendMessageAsync | ( | const MESSAGE_TYPE & | message | ) | const [inline] |
Sends a message asynchronously, being cloned and queued to the message loop which is targeted by the destination.
Definition at line 305 of file UTMessageDestination.h.