Files
UnrealEngineUWP/Engine/Source/Developer/TargetDeviceServices/Private/TargetDeviceServiceManager.h
Max Preussner 3aece47882 Docs: Removed file comments and added missing code documentation
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]
2014-06-12 23:22:18 -04:00

126 lines
3.2 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
/**
* Implements a target device service manager.
*
* Services that were running at the
*/
class FTargetDeviceServiceManager
: public ITargetDeviceServiceManager
{
public:
/**
* Default constructor.
*/
FTargetDeviceServiceManager( );
/**
* Destructor.
*/
~FTargetDeviceServiceManager( );
public:
// ITargetDeviceServiceManager interface
virtual bool AddStartupService( const FTargetDeviceId& DeviceId, const FString& PreliminaryDeviceName ) override;
virtual int32 GetServices( TArray<ITargetDeviceServicePtr>& OutServices ) override;
DECLARE_DERIVED_EVENT(FTargetDeviceServiceManager, ITargetDeviceServiceManager::FOnTargetDeviceServiceAdded, FOnTargetDeviceServiceAdded);
virtual FOnTargetDeviceServiceAdded& OnServiceAdded( ) override
{
return ServiceAddedDelegate;
}
DECLARE_DERIVED_EVENT(FTargetDeviceServiceManager, ITargetDeviceServiceManager::FOnTargetDeviceServiceRemoved, FOnTargetDeviceServiceRemoved);
virtual FOnTargetDeviceServiceRemoved& OnServiceRemoved( ) override
{
return ServiceRemovedDelegate;
}
virtual void RemoveStartupService( const FTargetDeviceId& DeviceId ) override;
protected:
/**
* Adds a device service for the given target device.
*
* @param DeviceId The identifier of the device to add a service for.
* @param PreliminaryDeviceName The preliminary name to assign to this device.
* @return true if the service was created, false otherwise.
*/
bool AddService( const FTargetDeviceId& DeviceId, const FString& PreliminaryDeviceName );
/**
* Initializes target platforms callbacks.
*
* @see ShutdownTargetPlatforms
*/
void InitializeTargetPlatforms( );
/**
* Loads all settings from disk.
*
* @see SaveSettings
*/
void LoadSettings( );
/**
* Removes the device service for the given target device.
*
* @param DeviceId The identifier of the device to remove the service for.
*/
void RemoveService( const FTargetDeviceId& DeviceId );
/**
* Saves all settings to disk.
*
* @see LoadSettings
*/
void SaveSettings( );
/**
* Shuts down target platforms callbacks.
*
* @see InitializeTargetPlatforms
*/
void ShutdownTargetPlatforms( );
private:
// Callback for handling message bus shutdowns.
void HandleMessageBusShutdown( );
// Callback for discovered target devices.
void HandleTargetPlatformDeviceDiscovered( const ITargetDeviceRef& DiscoveredDevice );
// Callback for lost target devices.
void HandleTargetPlatformDeviceLost( const ITargetDeviceRef& LostDevice );
private:
// Holds a critical section object.
FCriticalSection CriticalSection;
// Holds the list of locally managed device services.
TMap<FTargetDeviceId, ITargetDeviceServicePtr> DeviceServices;
// Holds a weak pointer to the message bus.
IMessageBusWeakPtr MessageBusPtr;
// Holds the collection of identifiers for devices that start automatically (shared/unshared).
TMap<FTargetDeviceId, bool> StartupServices;
private:
// Holds a delegate that is invoked when a target device service was added.
FOnTargetDeviceServiceAdded ServiceAddedDelegate;
// Holds a delegate that is invoked when a target device service was removed.
FOnTargetDeviceServiceRemoved ServiceRemovedDelegate;
};