You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Added frontend search engine to cache frontend queries - Allowing frontend queries to be updated in place. - Tracking node registration transactions to allow incremental runtime checks of newly registered nodes. - Create public RegistryContainer interface and hide implementation to allow for further optimizations without changing public headers #jira UEAU-749 #rb Max.Hayes, Jimmy.Smith #preflight 606399a6e05c4e0001a0d173 #ROBOMERGE-SOURCE: CL 15868737 in //UE5/Release-5.0-EarlyAccess/... #ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v786-15839533) [CL 15868744 by phil popp in ue5-main branch]
127 lines
2.7 KiB
C++
127 lines
2.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
#include "MetasoundFrontendRegistryTransaction.h"
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
namespace Metasound
|
|
{
|
|
namespace Frontend
|
|
{
|
|
FRegistryTransactionID GetOriginRegistryTransactionID()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
FRegistryTransactionHistory::FRegistryTransactionHistory()
|
|
: Current(GetOriginRegistryTransactionID())
|
|
{
|
|
}
|
|
|
|
FRegistryTransactionID FRegistryTransactionHistory::Add(TUniquePtr<IRegistryTransaction>&& InRegistryTransaction)
|
|
{
|
|
FScopeLock Lock(&RegistryTransactionMutex);
|
|
|
|
if (ensure(InRegistryTransaction.IsValid()))
|
|
{
|
|
Current++;
|
|
|
|
IRegistryTransaction* RegistryTransactionPointer = InRegistryTransaction.Get();
|
|
int32 Index = RegistryTransactions.Num();
|
|
|
|
RegistryTransactions.Add(MoveTemp(InRegistryTransaction));
|
|
RegistryTransactionIndexMap.Add(Current, Index);
|
|
}
|
|
|
|
return Current;
|
|
}
|
|
|
|
FRegistryTransactionID FRegistryTransactionHistory::Add(const IRegistryTransaction& InRegistryTransaction)
|
|
{
|
|
return Add(InRegistryTransaction.Clone());
|
|
}
|
|
|
|
FRegistryTransactionID FRegistryTransactionHistory::GetCurrent() const
|
|
{
|
|
FScopeLock Lock(&RegistryTransactionMutex);
|
|
{
|
|
return Current;
|
|
}
|
|
}
|
|
|
|
TArray<const IRegistryTransaction*> FRegistryTransactionHistory::GetTransactions(FRegistryTransactionID InSince, FRegistryTransactionID* OutCurrent) const
|
|
{
|
|
FScopeLock Lock(&RegistryTransactionMutex);
|
|
{
|
|
TArray<const IRegistryTransaction*> Result;
|
|
|
|
if (nullptr != OutCurrent)
|
|
{
|
|
*OutCurrent = Current;
|
|
}
|
|
|
|
int32 Start = INDEX_NONE;
|
|
|
|
if (GetOriginRegistryTransactionID() == InSince)
|
|
{
|
|
Start = 0;
|
|
}
|
|
else if (const int32* Pos = RegistryTransactionIndexMap.Find(InSince))
|
|
{
|
|
Start = *Pos + 1;
|
|
}
|
|
|
|
if (INDEX_NONE != Start)
|
|
{
|
|
const int32 Num = RegistryTransactions.Num();
|
|
|
|
if (ensure(Start <= Num))
|
|
{
|
|
const int32 OutNum = Num - Start;
|
|
if (OutNum > 0)
|
|
{
|
|
Result.Reserve(OutNum);
|
|
for (int32 i = Start; i < Num; i++)
|
|
{
|
|
Result.Add(RegistryTransactions[i].Get());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
}
|
|
|
|
FRegistryTransactionPtr MakeNodeRegistrationTransaction(const FNodeClassInfo& InInfo)
|
|
{
|
|
class FNodeRegistrationTransaction : public IRegistryTransaction
|
|
{
|
|
public:
|
|
FNodeRegistrationTransaction(const FNodeClassInfo& InNodeClassInfo)
|
|
: NodeClassInfo(InNodeClassInfo)
|
|
{
|
|
}
|
|
|
|
TUniquePtr<IRegistryTransaction> Clone() const override
|
|
{
|
|
return MakeUnique<FNodeRegistrationTransaction>(*this);
|
|
}
|
|
|
|
const FNodeClassInfo* GetNodeClassInfo() const
|
|
{
|
|
return &NodeClassInfo;
|
|
}
|
|
|
|
private:
|
|
|
|
FNodeClassInfo NodeClassInfo;
|
|
};
|
|
|
|
return MakeUnique<FNodeRegistrationTransaction>(InInfo);
|
|
}
|
|
}
|
|
}
|