engine
 
载入中...
搜索中...
未找到
Public 类型 | Public 成员函数 | 静态 Public 成员函数 | Protected 成员函数 | 所有成员列表
FMessageEndpoint类 参考

Implements a message endpoint for sending and receiving messages on a message bus. 更多...

#include <MessageEndpoint.h>

+ 类 FMessageEndpoint 继承关系图:

Public 类型

typedef struct FMessageEndpointBuilder Builder
 Type definition for the endpoint builder. 更多...
 

Public 成员函数

void Defer (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context, const FTimespan &Delay)
 Defers processing of the given message by the specified time delay. 更多...
 
void Disable ()
 Disables this endpoint. 更多...
 
void DisableInbox ()
 Disables the inbox for unhandled messages. 更多...
 
void Enable ()
 Enables this endpoint. 更多...
 
void EnableInbox ()
 Enables the inbox for unhandled messages. 更多...
 
 FMessageEndpoint (const FName &InName, const TSharedRef< IMessageBus, ESPMode::ThreadSafe > &InBus, const TArray< TSharedPtr< IMessageHandler, ESPMode::ThreadSafe > > &InHandlers, const FOnBusNotification InNotificationDelegate)
 Creates and initializes a new instance. 更多...
 
void Forward (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context, const FMessageAddress &Recipient)
 Immediately forwards a previously received message to the specified recipient. 更多...
 
void Forward (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context, const FMessageAddress &Recipient, const FTimespan &Delay)
 Forwards a previously received message to the specified recipient after a given delay. 更多...
 
void Forward (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context, const TArray< FMessageAddress > &Recipients)
 Immediately forwards a previously received message to the specified list of recipients. 更多...
 
void Forward (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay)
 Forwards a previously received message. 更多...
 
const FMessageAddress & GetAddress () const
 Gets the endpoint's message address. 更多...
 
virtual FName GetDebugName () const override
 Gets the recipient's name (for debugging purposes). 更多...
 
virtual ENamedThreads::Type GetListenerThread () const override
 Gets the name of the thread on which to receive notifications. 更多...
 
virtual const FGuid & GetRecipientId () const override
 Gets the recipient's unique identifier (for debugging purposes). 更多...
 
virtual ENamedThreads::Type GetRecipientThread () const override
 Gets the name of the thread on which to receive messages. 更多...
 
virtual FMessageAddress GetSenderAddress () override
 Gets the sender's address. 更多...
 
bool IsConnected () const
 Checks whether this endpoint is connected to the bus. 更多...
 
bool IsEnabled () const
 Checks whether this endpoint is enabled. 更多...
 
bool IsInboxEmpty () const
 Checks whether the inbox is empty. 更多...
 
bool IsInboxEnabled () const
 Checks whether the inbox is enabled. 更多...
 
virtual bool IsLocal () const override
 Checks whether this recipient represents a local endpoint. 更多...
 
virtual void NotifyMessageError (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context, const FString &Error) override
 Notifies the sender of errors. 更多...
 
virtual void NotifyRegistration (const FMessageAddress &InAddress, EMessageBusNotification InNotification)
 Notify a registration event from the bus This is called when a receiver is registered or unregistered from the bus. 更多...
 
void ProcessInbox ()
 Calls the matching message handlers for all messages queued up in the inbox. 更多...
 
template<typename MessageType >
void Publish (MessageType *Message)
 Immediately publishes a message to all subscribed recipients. 更多...
 
template<typename MessageType >
void Publish (MessageType *Message, const FTimespan &Delay)
 Publishes a message to all subscribed recipients after a given delay. 更多...
 
template<typename MessageType >
void Publish (MessageType *Message, const TMap< FName, FString > Annotations)
 Immediately publishes a message to all subscribed recipients. 更多...
 
template<typename MessageType >
void Publish (MessageType *Message, const TMap< FName, FString > Annotations, EMessageScope Scope)
 Immediately pa message to all subscribed recipients within the specified scope. 更多...
 
template<typename MessageType >
void Publish (MessageType *Message, const TMap< FName, FString > Annotations, EMessageScope Scope, const FTimespan &Delay, const FDateTime &Expiration)
 Publishes a message to all subscribed recipients within the specified scope. 更多...
 
template<typename MessageType >
void Publish (MessageType *Message, EMessageScope Scope)
 Immediately pa message to all subscribed recipients within the specified scope. 更多...
 
template<typename MessageType >
void Publish (MessageType *Message, EMessageScope Scope, const FTimespan &Delay)
 Publishes a message to all subscribed recipients within the specified scope after a given delay. 更多...
 
template<typename MessageType >
void Publish (MessageType *Message, EMessageScope Scope, const FTimespan &Delay, const FDateTime &Expiration)
 Publishes a message to all subscribed recipients within the specified scope. 更多...
 
void Publish (void *Message, UScriptStruct *TypeInfo, EMessageScope Scope, const FTimespan &Delay, const FDateTime &Expiration)
 Publishes a message to all subscribed recipients within the specified scope. 更多...
 
void Publish (void *Message, UScriptStruct *TypeInfo, EMessageScope Scope, const TMap< FName, FString > Annotations, const FTimespan &Delay, const FDateTime &Expiration)
 Publishes a message to all subscribed recipients within the specified scope. 更多...
 
bool ReceiveFromInbox (TSharedPtr< IMessageContext, ESPMode::ThreadSafe > &OutContext)
 Receives a single message from the endpoint's inbox. 更多...
 
virtual void ReceiveMessage (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context) override
 Handles the given message. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const FMessageAddress &Recipient)
 Immediately sends a message to the specified recipient. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const FMessageAddress &Recipient, const FTimespan &Delay)
 Sends a message to the specified recipient after a given delay. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const FMessageAddress &Recipient, const FTimespan &Delay, const FDateTime &Expiration)
 Sends a message with fields and expiration to the specified recipient after a given delay. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const TArray< FMessageAddress > &Recipients)
 Immediately sends a message to the specified list of recipients. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay)
 Sends a message to the specified list of recipients after a given delay after a given delay. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const TMap< FName, FString > Annotations, const FMessageAddress &Recipient)
 Immediately sends a message to the specified recipient. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const TMap< FName, FString > Annotations, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const FMessageAddress &Recipient, const FDateTime &Expiration, const FTimespan &Delay)
 Sends a message with fields, attachment and expiration to the specified recipient after a given delay. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const FMessageAddress &Recipient)
 Sends a message with fields and attachment to the specified recipient. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const FMessageAddress &Recipient, const FDateTime &Expiration, const FTimespan &Delay)
 Sends a message with fields, attachment and expiration to the specified recipient after a given delay. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay)
 Sends a message with fields and attachment to the specified list of recipients after a given delay. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay, const FDateTime &Expiration)
 Sends a message to the specified list of recipients. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, EMessageFlags Flags, const TMap< FName, FString > Annotations, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay, const FDateTime &Expiration)
 Sends a message to the specified list of recipients. 更多...
 
template<typename MessageType >
void Send (MessageType *Message, EMessageFlags Flags, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay, const FDateTime &Expiration)
 Sends a message to the specified list of recipients. 更多...
 
void Send (void *Message, UScriptStruct *TypeInfo, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay, const FDateTime &Expiration)
 Sends a message to the specified list of recipients. 更多...
 
void Send (void *Message, UScriptStruct *TypeInfo, EMessageFlags Flags, const TMap< FName, FString > Annotations, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay, const FDateTime &Expiration)
 Sends a message to the specified list of recipients. 更多...
 
void Send (void *Message, UScriptStruct *TypeInfo, EMessageFlags Flags, const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &Attachment, const TArray< FMessageAddress > &Recipients, const FTimespan &Delay, const FDateTime &Expiration)
 Sends a message to the specified list of recipients. 更多...
 
void SetRecipientThread (const ENamedThreads::Type &NamedThread)
 Sets the name of the thread to receive messages on. 更多...
 
template<class MessageType >
void Subscribe ()
 Template method to subscribe the message endpoint to the specified type of messages with the default message scope. 更多...
 
template<class MessageType >
void Subscribe (const FMessageScopeRange &ScopeRange)
 Template method to subscribe the message endpoint to the specified type and scope of messages. 更多...
 
void Subscribe (const FName &MessageType, const FMessageScopeRange &ScopeRange)
 Subscribes a message handler. 更多...
 
void Unsubscribe ()
 Unsubscribes this endpoint from all message types. 更多...
 
template<class MessageType >
void Unsubscribe ()
 Template method to unsubscribe the endpoint from the specified message type. 更多...
 
void Unsubscribe (const FName &TopicPattern)
 Unsubscribes this endpoint from the specified message type. 更多...
 
 ~FMessageEndpoint ()
 Destructor.
 
- Public 成员函数 继承自 TSharedFromThis< FMessageEndpoint, ESPMode::ThreadSafe >
TSharedRef< FMessageEndpoint, Mode > AsShared ()
 Provides access to a shared reference to this object. 更多...
 
TSharedRef< FMessageEndpoint const, Mode > AsShared () const
 Provides access to a shared reference to this object (const.) Note that is only valid to call this after a shared reference (or shared pointer) to the object has already been created. 更多...
 
FORCEINLINE bool DoesSharedInstanceExist () const
 Checks whether our referenced instance is valid (ie, whether it's safe to call AsShared). 更多...
 
FORCEINLINE void UpdateWeakReferenceInternal (TSharedPtr< SharedPtrType, Mode > const *InSharedPtr, OtherType *InObject) const
 INTERNAL USE ONLY – Do not call this method. 更多...
 
FORCEINLINE void UpdateWeakReferenceInternal (TSharedRef< SharedRefType, Mode > const *InSharedRef, OtherType *InObject) const
 INTERNAL USE ONLY – Do not call this method. 更多...
 
- Public 成员函数 继承自 IMessageReceiver
virtual FName GetDebugName () const =0
 Gets the recipient's name (for debugging purposes). 更多...
 
virtual const FGuid & GetRecipientId () const =0
 Gets the recipient's unique identifier (for debugging purposes). 更多...
 
virtual ENamedThreads::Type GetRecipientThread () const =0
 Gets the name of the thread on which to receive messages. 更多...
 
virtual bool IsLocal () const =0
 Checks whether this recipient represents a local endpoint. 更多...
 
bool IsRemote () const
 Checks whether this recipient represents a remote endpoint. 更多...
 
virtual void ReceiveMessage (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context)=0
 Handles the given message. 更多...
 
virtual ~IMessageReceiver ()
 Virtual destructor.
 
- Public 成员函数 继承自 IMessageSender
virtual FMessageAddress GetSenderAddress ()=0
 Gets the sender's address. 更多...
 
virtual void NotifyMessageError (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context, const FString &Error)=0
 Notifies the sender of errors. 更多...
 
virtual ~IMessageSender ()
 Virtual destructor.
 
virtual ENamedThreads::Type GetListenerThread () const =0
 Gets the name of the thread on which to receive notifications. 更多...
 
virtual void NotifyRegistration (const FMessageAddress &Address, EMessageBusNotification Notification)=0
 Notify a registration event from the bus This is called when a receiver is registered or unregistered from the bus. 更多...
 

静态 Public 成员函数

static void SafeRelease (TSharedPtr< FMessageEndpoint, ESPMode::ThreadSafe > &Endpoint)
 Safely releases a message endpoint that is receiving messages on AnyThread. 更多...
 

Protected 成员函数

void ClearHandlers ()
 Clears all handlers in a way that guarantees it won't overlap with message processing. 更多...
 
FORCEINLINE TSharedPtr< IMessageBus, ESPMode::ThreadSafe > GetBusIfEnabled () const
 Gets a shared pointer to the message bus if this endpoint is enabled. 更多...
 
void ProcessMessage (const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context)
 Forwards the given message context to matching message handlers. 更多...
 
- Protected 成员函数 继承自 TSharedFromThis< FMessageEndpoint, ESPMode::ThreadSafe >
FORCEINLINE TSharedFromThis & operator= (TSharedFromThis const &)
 Hidden stub assignment operator
 
 TSharedFromThis ()
 Hidden stub constructor
 
 TSharedFromThis (TSharedFromThis const &)
 Hidden stub copy constructor
 
 ~TSharedFromThis ()
 Hidden destructor
 

额外继承的成员函数

- 静态 Protected 成员函数 继承自 TSharedFromThis< FMessageEndpoint, ESPMode::ThreadSafe >
static FORCEINLINE TSharedRef< OtherType const, Mode > SharedThis (const OtherType *ThisPtr)
 Provides access to a shared reference to an object, given the object's 'this' pointer. 更多...
 
static FORCEINLINE TSharedRef< OtherType, Mode > SharedThis (OtherType *ThisPtr)
 Provides access to a shared reference to an object, given the object's 'this' pointer. 更多...
 

详细描述

Implements a message endpoint for sending and receiving messages on a message bus.

This class provides a convenient implementation of the IMessageReceiver and IMessageSender interfaces, which allow consumers to send and receive messages on a message bus. The endpoint allows for receiving messages asynchronously as they arrive, as well as synchronously through an inbox that can be polled.

By default, messages are received synchronously on the thread that the endpoint was created on. If the message consumer is thread-safe, a more efficient message dispatch can be enabled by calling the SetRecipientThread() method with ENamedThreads::AnyThread.

Endpoints that are destroyed or receive messages on non-Game threads should use the static function FMessageEndpoint::SafeRelease() to dispose of the endpoint. This will ensure that there are no race conditions between endpoint destruction and the receiving of messages.

The underlying message bus will take ownership of all sent and published message objects. The memory held by the messages must therefore NOT be freed by the caller.

成员类型定义说明

◆ Builder

Type definition for the endpoint builder.

When building message endpoints that receive messages on AnyThread, use the SafeRelease helper function to avoid race conditions when destroying the objects that own the endpoints.

参见
SafeRelease

构造及析构函数说明

◆ FMessageEndpoint()

FMessageEndpoint::FMessageEndpoint ( const FName &  InName,
const TSharedRef< IMessageBus, ESPMode::ThreadSafe > &  InBus,
const TArray< TSharedPtr< IMessageHandler, ESPMode::ThreadSafe > > &  InHandlers,
const FOnBusNotification  InNotificationDelegate 
)
inline

Creates and initializes a new instance.

参数
InNameThe endpoint's name (for debugging purposes).
InBusThe message bus to attach this endpoint to.
InHandlersThe collection of message handlers to register.

成员函数说明

◆ ClearHandlers()

void FMessageEndpoint::ClearHandlers ( )
inlineprotected

Clears all handlers in a way that guarantees it won't overlap with message processing.

This preserves internal integrity of the array and cases where our owner may be shutting down while receiving messages.

◆ Defer()

void FMessageEndpoint::Defer ( const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &  Context,
const FTimespan &  Delay 
)
inline

Defers processing of the given message by the specified time delay.

The message is effectively delivered again to this endpoint after the original sent time plus the time delay have elapsed.

参数
ContextThe context of the message to defer.
DelayThe time delay.

◆ Disable()

void FMessageEndpoint::Disable ( )
inline

Disables this endpoint.

A disabled endpoint will not receive any subscribed messages until it is enabled again. Endpoints should be created in an enabled state by default.

参见
Enable, IsEnabled

◆ DisableInbox()

void FMessageEndpoint::DisableInbox ( )
inline

Disables the inbox for unhandled messages.

The inbox is disabled by default.

参见
EnableInbox, IsInboxEmpty, IsInboxEnabled, ProcessInbox, ReceiveFromInbox

◆ Enable()

void FMessageEndpoint::Enable ( )
inline

Enables this endpoint.

An activated endpoint will receive subscribed messages. Endpoints should be created in an enabled state by default.

参见
Disable, IsEnabled

◆ EnableInbox()

void FMessageEndpoint::EnableInbox ( )
inline

Enables the inbox for unhandled messages.

If enabled, the inbox will queue up all received messages. Use ProcessInbox() to synchronously invoke the registered message handlers for all queued up messages, or ReceiveFromInbox() to manually receive one message from the inbox at a time. The inbox is disabled by default.

参见
DisableInbox, IsInboxEmpty, IsInboxEnabled, ProcessInbox, ReceiveFromInbox

◆ Forward() [1/4]

void FMessageEndpoint::Forward ( const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &  Context,
const FMessageAddress &  Recipient 
)
inline

Immediately forwards a previously received message to the specified recipient.

Messages can only be forwarded to endpoints within the same process.

参数
ContextThe context of the message to forward.
RecipientThe address of the recipient to forward the message to.

◆ Forward() [2/4]

void FMessageEndpoint::Forward ( const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &  Context,
const FMessageAddress &  Recipient,
const FTimespan &  Delay 
)
inline

Forwards a previously received message to the specified recipient after a given delay.

Messages can only be forwarded to endpoints within the same process.

参数
ContextThe context of the message to forward.
RecipientThe address of the recipient to forward the message to.
ForwardingScopeThe scope of the forwarded message.
DelayThe delay after which to publish the message.

◆ Forward() [3/4]

void FMessageEndpoint::Forward ( const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &  Context,
const TArray< FMessageAddress > &  Recipients 
)
inline

Immediately forwards a previously received message to the specified list of recipients.

Messages can only be forwarded to endpoints within the same process.

参数
ContextThe context of the message to forward.
RecipientsThe list of message recipients to forward the message to.
ForwardingScopeThe scope of the forwarded message.

◆ Forward() [4/4]

void FMessageEndpoint::Forward ( const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &  Context,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay 
)
inline

Forwards a previously received message.

Messages can only be forwarded to endpoints within the same process.

参数
ContextThe context of the message to forward.
RecipientsThe list of message recipients to forward the message to.
DelayThe time delay.

◆ GetAddress()

const FMessageAddress & FMessageEndpoint::GetAddress ( ) const
inline

Gets the endpoint's message address.

返回
Message address.

◆ GetBusIfEnabled()

FORCEINLINE TSharedPtr< IMessageBus, ESPMode::ThreadSafe > FMessageEndpoint::GetBusIfEnabled ( ) const
inlineprotected

Gets a shared pointer to the message bus if this endpoint is enabled.

返回
The message bus.

◆ GetDebugName()

virtual FName FMessageEndpoint::GetDebugName ( ) const
inlineoverridevirtual

Gets the recipient's name (for debugging purposes).

返回
The debug name.
参见
GetRecipientId, GetRecipientThread

实现了 IMessageReceiver.

◆ GetListenerThread()

virtual ENamedThreads::Type FMessageEndpoint::GetListenerThread ( ) const
inlineoverridevirtual

Gets the name of the thread on which to receive notifications.

If the listener's Notify[*] methods are thread-safe, return ThreadAny for best performance.

返回
Name of the listener thread.

实现了 IBusListener.

◆ GetRecipientId()

virtual const FGuid & FMessageEndpoint::GetRecipientId ( ) const
inlineoverridevirtual

Gets the recipient's unique identifier (for debugging purposes).

返回
The recipient's identifier.
参见
GetDebugName, GetRecipientThread

实现了 IMessageReceiver.

◆ GetRecipientThread()

virtual ENamedThreads::Type FMessageEndpoint::GetRecipientThread ( ) const
inlineoverridevirtual

Gets the name of the thread on which to receive messages.

If the recipient's ReceiveMessage() is thread-safe, return ThreadAny for best performance.

返回
Name of the receiving thread.
参见
GetDebugName, GetRecipientId

实现了 IMessageReceiver.

◆ GetSenderAddress()

virtual FMessageAddress FMessageEndpoint::GetSenderAddress ( )
inlineoverridevirtual

Gets the sender's address.

返回
The message address.

实现了 IMessageSender.

◆ IsConnected()

bool FMessageEndpoint::IsConnected ( ) const
inline

Checks whether this endpoint is connected to the bus.

返回
true if connected, false otherwise.
参见
IsEnabled

◆ IsEnabled()

bool FMessageEndpoint::IsEnabled ( ) const
inline

Checks whether this endpoint is enabled.

返回
true if the endpoint is enabled, false otherwise.
参见
Disable, Enable, IsConnected

◆ IsInboxEmpty()

bool FMessageEndpoint::IsInboxEmpty ( ) const
inline

Checks whether the inbox is empty.

返回
true if the inbox is empty, false otherwise.
参见
DisableInbox, EnableInbox, IsInboxEnabled, ProcessInbox, ReceiveFromInbox

◆ IsInboxEnabled()

bool FMessageEndpoint::IsInboxEnabled ( ) const
inline

Checks whether the inbox is enabled.

参见
DisableInbox, EnableInbox, IsInboxEmpty, ProcessInbox, ReceiveFromInbox

◆ IsLocal()

virtual bool FMessageEndpoint::IsLocal ( ) const
inlineoverridevirtual

Checks whether this recipient represents a local endpoint.

Local recipients are located in the current thread or process. Recipients located in other processes on the same machine or on remote machines are considered remote.

返回
true if this recipient is local, false otherwise.
参见
IsRemote

实现了 IMessageReceiver.

◆ NotifyMessageError()

virtual void FMessageEndpoint::NotifyMessageError ( const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &  Context,
const FString &  Error 
)
inlineoverridevirtual

Notifies the sender of errors.

参数
ContextThe context of the message that generated the error.
ErrorThe error string.

实现了 IMessageSender.

◆ NotifyRegistration()

virtual void FMessageEndpoint::NotifyRegistration ( const FMessageAddress &  Address,
EMessageBusNotification  Notification 
)
inlinevirtual

Notify a registration event from the bus This is called when a receiver is registered or unregistered from the bus.

参数
AddressThe address of the recipient that just un/registered from the bus.
NotificationThe even type, either Registered or Unregistered

实现了 IBusListener.

◆ ProcessInbox()

void FMessageEndpoint::ProcessInbox ( )
inline

Calls the matching message handlers for all messages queued up in the inbox.

Note that an incoming message will only be queued up in the endpoint's inbox if the inbox has been enabled and no matching message handler handled it. The inbox is disabled by default and must be enabled using the EnableInbox() method.

参见
IsInboxEmpty, ReceiveFromInbox

◆ ProcessMessage()

void FMessageEndpoint::ProcessMessage ( const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &  Context)
inlineprotected

Forwards the given message context to matching message handlers.

参数
ContextThe context of the message to handle.

◆ Publish() [1/10]

template<typename MessageType >
void FMessageEndpoint::Publish ( MessageType *  Message)
inline

Immediately publishes a message to all subscribed recipients.

参数
MessageThe message to publish.

◆ Publish() [2/10]

template<typename MessageType >
void FMessageEndpoint::Publish ( MessageType *  Message,
const FTimespan &  Delay 
)
inline

Publishes a message to all subscribed recipients after a given delay.

参数
MessageThe message to publish.
DelayThe delay after which to publish the message.

◆ Publish() [3/10]

template<typename MessageType >
void FMessageEndpoint::Publish ( MessageType *  Message,
const TMap< FName, FString >  Annotations 
)
inline

Immediately publishes a message to all subscribed recipients.

参数
MessageThe message to publish.
AnnotationsAn optional message annotations header.

◆ Publish() [4/10]

template<typename MessageType >
void FMessageEndpoint::Publish ( MessageType *  Message,
const TMap< FName, FString >  Annotations,
EMessageScope  Scope 
)
inline

Immediately pa message to all subscribed recipients within the specified scope.

参数
MessageThe message to publish.
AnnotationsAn optional message annotations header.
ScopeThe message scope.

◆ Publish() [5/10]

template<typename MessageType >
void FMessageEndpoint::Publish ( MessageType *  Message,
const TMap< FName, FString >  Annotations,
EMessageScope  Scope,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Publishes a message to all subscribed recipients within the specified scope.

参数
MessageThe message to publish.
AnnotationsAn optional message annotations header.
ScopeThe message scope.
FieldsThe message content.
DelayThe delay after which to publish the message.
ExpirationThe time at which the message expires.

◆ Publish() [6/10]

template<typename MessageType >
void FMessageEndpoint::Publish ( MessageType *  Message,
EMessageScope  Scope 
)
inline

Immediately pa message to all subscribed recipients within the specified scope.

参数
MessageThe message to publish.
ScopeThe message scope.

◆ Publish() [7/10]

template<typename MessageType >
void FMessageEndpoint::Publish ( MessageType *  Message,
EMessageScope  Scope,
const FTimespan &  Delay 
)
inline

Publishes a message to all subscribed recipients within the specified scope after a given delay.

参数
MessageThe message to publish.
ScopeThe message scope.
DelayThe delay after which to publish the message.

◆ Publish() [8/10]

template<typename MessageType >
void FMessageEndpoint::Publish ( MessageType *  Message,
EMessageScope  Scope,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Publishes a message to all subscribed recipients within the specified scope.

参数
MessageThe message to publish.
ScopeThe message scope.
FieldsThe message content.
DelayThe delay after which to publish the message.
ExpirationThe time at which the message expires.

◆ Publish() [9/10]

void FMessageEndpoint::Publish ( void *  Message,
UScriptStruct *  TypeInfo,
EMessageScope  Scope,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Publishes a message to all subscribed recipients within the specified scope.

参数
MessageThe message to publish.
TypeInfoThe message's type information.
ScopeThe message scope.
FieldsThe message content.
DelayThe delay after which to publish the message.
ExpirationThe time at which the message expires.

◆ Publish() [10/10]

void FMessageEndpoint::Publish ( void *  Message,
UScriptStruct *  TypeInfo,
EMessageScope  Scope,
const TMap< FName, FString >  Annotations,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Publishes a message to all subscribed recipients within the specified scope.

参数
MessageThe message to publish.
TypeInfoThe message's type information.
ScopeThe message scope.
AnnotationsAn optional message annotations header.
FieldsThe message content.
DelayThe delay after which to publish the message.
ExpirationThe time at which the message expires.

◆ ReceiveFromInbox()

bool FMessageEndpoint::ReceiveFromInbox ( TSharedPtr< IMessageContext, ESPMode::ThreadSafe > &  OutContext)
inline

Receives a single message from the endpoint's inbox.

Note that an incoming message will only be queued up in the endpoint's inbox if the inbox has been enabled and no matching message handler handled it. The inbox is disabled by default and must be enabled using the EnableInbox() method.

参数
OutContextWill hold the context of the received message.
返回
true if a message was received, false if the inbox was empty.
参见
DisableInbox, EnableInbox, IsInboxEnabled, ProcessInbox

◆ ReceiveMessage()

virtual void FMessageEndpoint::ReceiveMessage ( const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &  Context)
inlineoverridevirtual

Handles the given message.

参数
ContextWill hold the context of the received message.

实现了 IMessageReceiver.

◆ SafeRelease()

static void FMessageEndpoint::SafeRelease ( TSharedPtr< FMessageEndpoint, ESPMode::ThreadSafe > &  Endpoint)
inlinestatic

Safely releases a message endpoint that is receiving messages on AnyThread.

When an object that owns a message endpoint receiving on AnyThread is being destroyed, it is possible that the endpoint can outlive the object for a brief period of time if the Messaging system is dispatching messages to it. This helper function is to block the calling thread while any messages are being dispatched, so that the endpoint does not invoke any message handlers after the object has been destroyed.

参数
EndpointThe message endpoint to release.

◆ Send() [1/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const FMessageAddress &  Recipient 
)
inline

Immediately sends a message to the specified recipient.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
RecipientThe message recipient.

◆ Send() [2/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const FMessageAddress &  Recipient,
const FTimespan &  Delay 
)
inline

Sends a message to the specified recipient after a given delay.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
RecipientThe message recipient.
DelayThe delay after which to send the message.

◆ Send() [3/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const FMessageAddress &  Recipient,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Sends a message with fields and expiration to the specified recipient after a given delay.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
RecipientThe message recipient.
ExpirationThe time at which the message expires.
DelayThe delay after which to send the message.

◆ Send() [4/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const TArray< FMessageAddress > &  Recipients 
)
inline

Immediately sends a message to the specified list of recipients.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
RecipientsThe message recipients.

◆ Send() [5/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay 
)
inline

Sends a message to the specified list of recipients after a given delay after a given delay.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
RecipientsThe message recipients.
DelayThe delay after which to send the message.

◆ Send() [6/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const TMap< FName, FString >  Annotations,
const FMessageAddress &  Recipient 
)
inline

Immediately sends a message to the specified recipient.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
AnnotationsAn optional message annotations header.
RecipientThe message recipient.

◆ Send() [7/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const TMap< FName, FString >  Annotations,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const FMessageAddress &  Recipient,
const FDateTime &  Expiration,
const FTimespan &  Delay 
)
inline

Sends a message with fields, attachment and expiration to the specified recipient after a given delay.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
AnnotationsAn optional message annotations header.
AttachmentAn optional binary data attachment.
RecipientThe message recipient.
ExpirationThe time at which the message expires.
DelayThe delay after which to send the message.

◆ Send() [8/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const FMessageAddress &  Recipient 
)
inline

Sends a message with fields and attachment to the specified recipient.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
AttachmentAn optional binary data attachment.
RecipientThe message recipient.

◆ Send() [9/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const FMessageAddress &  Recipient,
const FDateTime &  Expiration,
const FTimespan &  Delay 
)
inline

Sends a message with fields, attachment and expiration to the specified recipient after a given delay.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
AttachmentAn optional binary data attachment.
RecipientThe message recipient.
ExpirationThe time at which the message expires.
DelayThe delay after which to send the message.

◆ Send() [10/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay 
)
inline

Sends a message with fields and attachment to the specified list of recipients after a given delay.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
AttachmentAn optional binary data attachment.
RecipientsThe message recipients.
DelayThe delay after which to send the message.

◆ Send() [11/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Sends a message to the specified list of recipients.

参数
MessageTypeThe type of message to send.
MessageThe message to send.
AttachmentAn optional binary data attachment.
RecipientsThe message recipients.
DelayThe delay after which to send the message.
ExpirationThe time at which the message expires.

◆ Send() [12/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
EMessageFlags  Flags,
const TMap< FName, FString >  Annotations,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Sends a message to the specified list of recipients.

Allows to specify message flags

参数
MessageThe message to send.
TypeInfoThe message's type information.
FlagsThe message's type information.
AnnotationsAn optional message annotations header.
AttachmentAn optional binary data attachment.
RecipientsThe message recipients.
DelayThe delay after which to send the message.
ExpirationThe time at which the message expires.

◆ Send() [13/16]

template<typename MessageType >
void FMessageEndpoint::Send ( MessageType *  Message,
EMessageFlags  Flags,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Sends a message to the specified list of recipients.

Allows to specify message flags

参数
MessageThe message to send.
TypeInfoThe message's type information.
FlagsThe message's type information.
AttachmentAn optional binary data attachment.
RecipientsThe message recipients.
DelayThe delay after which to send the message.
ExpirationThe time at which the message expires.

◆ Send() [14/16]

void FMessageEndpoint::Send ( void *  Message,
UScriptStruct *  TypeInfo,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Sends a message to the specified list of recipients.

参数
MessageThe message to send.
TypeInfoThe message's type information.
AttachmentAn optional binary data attachment.
RecipientsThe message recipients.
DelayThe delay after which to send the message.
ExpirationThe time at which the message expires.

◆ Send() [15/16]

void FMessageEndpoint::Send ( void *  Message,
UScriptStruct *  TypeInfo,
EMessageFlags  Flags,
const TMap< FName, FString >  Annotations,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Sends a message to the specified list of recipients.

参数
MessageThe message to send.
TypeInfoThe message's type information.
FlagsThe message's type information.
AnnotationsAn optional message annotations header.
AttachmentAn optional binary data attachment.
RecipientsThe message recipients.
DelayThe delay after which to send the message.
ExpirationThe time at which the message expires.

◆ Send() [16/16]

void FMessageEndpoint::Send ( void *  Message,
UScriptStruct *  TypeInfo,
EMessageFlags  Flags,
const TSharedPtr< IMessageAttachment, ESPMode::ThreadSafe > &  Attachment,
const TArray< FMessageAddress > &  Recipients,
const FTimespan &  Delay,
const FDateTime &  Expiration 
)
inline

Sends a message to the specified list of recipients.

Allows to specify message flags

参数
MessageThe message to send.
TypeInfoThe message's type information.
FlagsThe message's type information.
AttachmentAn optional binary data attachment.
RecipientsThe message recipients.
DelayThe delay after which to send the message.
ExpirationThe time at which the message expires.

◆ SetRecipientThread()

void FMessageEndpoint::SetRecipientThread ( const ENamedThreads::Type &  NamedThread)
inline

Sets the name of the thread to receive messages on.

Use this method to receive messages on a particular thread, for example, if the consumer owning this endpoint is not thread-safe. The default value is ThreadAny.

ThreadAny is the fastest way to receive messages. It should be used if the receiving code is completely thread-safe and if it is sufficiently fast. ThreadAny MUST NOT be used if the receiving code is not thread-safe. It also SHOULD NOT be used if the code includes time consuming operations, because it will block the message router, causing no other messages to be delivered in the meantime.

参数
NamedThreadThe name of the thread to receive messages on.

◆ Subscribe() [1/3]

template<class MessageType >
void FMessageEndpoint::Subscribe ( )
inline

Template method to subscribe the message endpoint to the specified type of messages with the default message scope.

The default message scope is all messages excluding loopback messages.

参数
HandlerTypeThe type of the class handling the message.
MessageTypeThe type of messages to subscribe to.
HandlerThe class handling the messages.
HandlerFuncThe class function handling the messages.

◆ Subscribe() [2/3]

template<class MessageType >
void FMessageEndpoint::Subscribe ( const FMessageScopeRange &  ScopeRange)
inline

Template method to subscribe the message endpoint to the specified type and scope of messages.

参数
HandlerTypeThe type of the class handling the message.
MessageTypeThe type of messages to subscribe to.
HandlerThe class handling the messages.
HandlerFuncThe class function handling the messages.
ScopeRangeThe range of message scopes to include in the subscription.

◆ Subscribe() [3/3]

void FMessageEndpoint::Subscribe ( const FName &  MessageType,
const FMessageScopeRange &  ScopeRange 
)
inline

Subscribes a message handler.

参数
MessageTypeThe type name of the messages to subscribe to.
ScopeRangeThe range of message scopes to include in the subscription.

◆ Unsubscribe() [1/3]

void FMessageEndpoint::Unsubscribe ( )
inline

Unsubscribes this endpoint from all message types.

参见
Subscribe

◆ Unsubscribe() [2/3]

template<class MessageType >
void FMessageEndpoint::Unsubscribe ( )
inline

Template method to unsubscribe the endpoint from the specified message type.

参数
MessageTypeThe type of message to unsubscribe (NAME_All = all types).
参见
Subscribe

◆ Unsubscribe() [3/3]

void FMessageEndpoint::Unsubscribe ( const FName &  TopicPattern)
inline

Unsubscribes this endpoint from the specified message type.

参数
MessageTypeThe type of message to unsubscribe (NAME_All = all types).
参见
Subscribe

该类的文档由以下文件生成: