You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Please note that file comments had no purpose in nearly all cases and just added visual clutter. The two files that had meaningful file comments had their comments moved into the corresponding classes. There are still hundreds of file comments left in other files that will be removed over time. Also cleaned up some random stuff along the way: - relative paths to public headers within the same module are no longer necessary (automatically discovered by UBT now) - header guards are deprecated, use #pragma once instead (all compilers support it now) - space between multiple template brackets is no longer required (all compilers support >> now) - NULL to nullptr, OVERRIDE to override - spelling errors, whitespace, line breaks [CL 2104067 by Max Preussner in Main branch]
102 lines
2.4 KiB
C++
102 lines
2.4 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
|
|
/**
|
|
* Implements an application session service.
|
|
*/
|
|
class FSessionService
|
|
: public FOutputDevice
|
|
, public ISessionService
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* Creates and initializes a new instance.
|
|
*
|
|
* @param InMessageBus The message bus to use.
|
|
*/
|
|
FSessionService( const IMessageBusRef& InMessageBus );
|
|
|
|
/**
|
|
* Destructor.
|
|
*/
|
|
~FSessionService( );
|
|
|
|
public:
|
|
|
|
// FOutputDevice interface
|
|
|
|
virtual void Serialize( const TCHAR* Data, ELogVerbosity::Type Verbosity, const class FName& Category ) override
|
|
{
|
|
SendLog(Data, Verbosity, Category);
|
|
}
|
|
|
|
public:
|
|
|
|
// ISessionService interface
|
|
|
|
virtual bool IsRunning( ) override
|
|
{
|
|
return MessageEndpoint.IsValid();
|
|
}
|
|
|
|
virtual bool Start( ) override;
|
|
virtual void Stop( ) override;
|
|
|
|
protected:
|
|
|
|
/**
|
|
* Sends a log message to subscribed recipients.
|
|
*
|
|
* @param Data The log message data.
|
|
* @param Verbosity The verbosity type.
|
|
* @param Category The log category.
|
|
*/
|
|
void SendLog( const TCHAR* Data, ELogVerbosity::Type Verbosity = ELogVerbosity::Log, const class FName& Category = "Log" );
|
|
|
|
/**
|
|
* Sends a notification to the specified recipient.
|
|
*
|
|
* @param NotificationText The notification text.
|
|
* @param Recipient The recipient's message address.
|
|
*/
|
|
void SendNotification( const TCHAR* NotificationText, const FMessageAddress& Recipient );
|
|
|
|
/**
|
|
* Publishes a ping response.
|
|
*
|
|
* @param Context The context of the received Ping message.
|
|
*/
|
|
void SendPong( const IMessageContextRef& Context );
|
|
|
|
private:
|
|
|
|
// Handles message bus shutdowns.
|
|
void HandleMessageEndpointShutdown( );
|
|
|
|
// Handles FSessionServiceLogSubscribe messages.
|
|
void HandleSessionLogSubscribeMessage( const FSessionServiceLogSubscribe& Message, const IMessageContextRef& Context );
|
|
|
|
// Handles FSessionServiceLogUnsubscribe messages.
|
|
void HandleSessionLogUnsubscribeMessage( const FSessionServiceLogUnsubscribe& Message, const IMessageContextRef& Context );
|
|
|
|
// Handles FSessionServicePing messages.
|
|
void HandleSessionPingMessage( const FSessionServicePing& Message, const IMessageContextRef& Context );
|
|
|
|
private:
|
|
|
|
// Holds the list of log subscribers.
|
|
TArray<FMessageAddress> LogSubscribers;
|
|
|
|
// Holds a critical section for the log subscribers array.
|
|
FCriticalSection LogSubscribersLock;
|
|
|
|
// Holds a weak pointer to the message bus.
|
|
IMessageBusWeakPtr MessageBusPtr;
|
|
|
|
// Holds the message endpoint.
|
|
FMessageEndpointPtr MessageEndpoint;
|
|
};
|