Files
UnrealEngineUWP/Engine/Source/Runtime/Datasmith/DirectLink/Public/DirectLinkCommon.h
benoit deschenes f55fe34bb0 Adding ConnectionState member to FStreamInfo, allowing user-code to distinguish between "real" inactive streams and those that are just waiting for a response.
Also fixing crash when accessing UDirectLinkExtensionSettings CDO on engine shutdown.

#jira UE-138473
#rb Johan.Duparc
Johan.Duparc
#preflight 61dc8dfce67256ec41ee68e5

#ROBOMERGE-AUTHOR: benoit.deschenes
#ROBOMERGE-SOURCE: CL 18564205 in //UE5/Release-5.0/... via CL 18564222
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18564231 by benoit deschenes in ue5-release-engine-test branch]
2022-01-10 15:07:05 -05:00

86 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreTypes.h"
#include "Misc/Guid.h"
#include "Templates/SharedPointer.h"
namespace DirectLink
{
/**
* Node Id, aka Element Id. Represent a node within a scene.
* As a scene has a guid, the combination guid/id must be globally unique.
*/
using FSceneGraphId = uint32;
constexpr FSceneGraphId InvalidId = 0;
using FElementHash = uint32;
constexpr FElementHash InvalidHash = 0;
using FStreamPort = uint32;
constexpr FStreamPort InvalidStreamPort = 0;
/**
* Guid and optional name, used to designate a scene across processes without ambiguity.
* The name is not necessary to identify a scene, but it offer a better UX
*/
struct FSceneIdentifier
{
FSceneIdentifier() = default;
FSceneIdentifier(const FGuid& Id, const FString& Name)
: SceneGuid(Id)
, DisplayName(Name)
{}
// Id of scene SharedState
FGuid SceneGuid;
// Nice user-facing name. Do not expect it to be stable or consistent.
FString DisplayName;
};
// DirectLink exchanges messages between pairs. Those versions numbers helps making sure pairs are compatible
uint8 GetCurrentProtocolVersion();
// oldest supported version
uint8 GetMinSupportedProtocolVersion();
/** Used by data source and destination to describe how they are discovered by remote endpoints */
enum class EVisibility
{
Public, // The connection point can accept connection requests from remote
Private, // The connection point is not expected to be contacted from a remote
};
enum class EStreamConnectionState
{
Uninitialized,
RequestSent,
Active,
Closed,
};
struct FCommunicationStatus
{
bool IsTransmitting() const { return bIsSending || bIsReceiving; }
bool IsProgressKnown() const { return TaskTotal > 0; };
float GetProgress() const { return IsProgressKnown() ? float(FMath::Clamp(TaskCompleted, 0, TaskTotal)) / TaskTotal : 0.0f; };
public:
bool bIsSending = false;
bool bIsReceiving = false;
int32 TaskTotal = 0;
int32 TaskCompleted = 0;
};
} // namespace DirectLink