Files
UnrealEngineUWP/Engine/Source/Runtime/Messaging/Public/IMessageSender.h
marc audy 6553e6cd0a Remove as much C++ deprecation as possible up to 4.17 (along with a few scattered removals from beyond)
#preflight 61eefc77ba69a4fdb220bf23

#ROBOMERGE-AUTHOR: marc.audy
#ROBOMERGE-SOURCE: CL 18712765 in //UE5/Release-5.0/... via CL 18712784 via CL 18713147
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18713191 by marc audy in ue5-main branch]
2022-01-24 15:07:48 -05:00

51 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "IMessageContext.h"
#include "Templates/SharedPointer.h"
class FString;
/**
* Interface for message senders.
*
* Classes that implement this interface are able to send messages on a message bus. Each message sender must be uniquely
* identifiable with a message address that is returned by the IMessageSender.GetSenderAddress method. It is recommended
* that implementors of this interface generate a GUID for each instance, which must not change throughout the lifetime of
* the instance.
*
* The sending of messages is accomplished with the IMessageBus.Forward, IMessageBus.Publish and IMessageBus.Send methods.
* In case an error occurs during the sending of a message, the IMessageSender.NotifyMessageError method will be called.
*
* This interface provides a rather low-level mechanism for receiving messages. Instead of implementing it, Most users will
* want to use an instance of FMessageEndpoint, which provides a much more convenient way of sending and receiving messages.
*
* @see FMessageEndpoint, IMessageBus, IMessageReceiver
*/
class IMessageSender
{
public:
/**
* Gets the sender's address.
*
* @return The message address.
*/
virtual FMessageAddress GetSenderAddress() = 0;
/**
* Notifies the sender of errors.
*
* @param Context The context of the message that generated the error.
* @param Error The error string.
*/
virtual void NotifyMessageError(const TSharedRef<IMessageContext, ESPMode::ThreadSafe>& Context, const FString& Error) = 0;
public:
/** Virtual destructor. */
virtual ~IMessageSender() { }
};