// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Engine/EngineBaseTypes.h" #include "Model/PointTimeline.h" #include "Containers/Map.h" #include "Templates/SharedPointer.h" #include "Model/IntervalTimeline.h" #include "TraceServices/Model/AnalysisSession.h" namespace TraceServices { class IAnalysisSession; } struct FChooserEvaluationData { uint64 ChooserId; int32 SelectedIndex; }; struct FChooserValueData { uint64 ChooserId; FName Key; // probably should get this using the linear allocator somehow: TArray Value; }; class FChooserProvider : public TraceServices::IProvider { public: typedef TraceServices::ITimeline ChooserEvaluationTimeline; typedef TraceServices::ITimeline ChooserValueTimeline; static FName ProviderName; FChooserProvider(TraceServices::IAnalysisSession& InSession); bool ReadChooserEvaluationTimeline(uint64 InObjectId, TFunctionRef Callback) const; bool ReadChooserValueTimeline(uint64 InObjectId, TFunctionRef Callback) const; void EnumerateChooserEvaluationTimelines(TFunctionRef Callback) const; void AppendChooserEvaluation(uint64 InObjectId, uint64 InChooser, int32 InResultId, double InRecordingTime); void AppendChooserValue(uint64 InChooserId, uint64 InObjectId, double InRecordingTime, const FName& Key, TArrayView SerializedValue) { Session.WriteAccessCheck(); TSharedPtr> Timeline = ChooserValueTimelines[GetTimelineIndex(InObjectId)]; FChooserValueData EventData; EventData.ChooserId = InChooserId; EventData.Key = Key; EventData.Value = SerializedValue; Timeline->AppendEvent(InRecordingTime, EventData); } private: uint32 GetTimelineIndex(uint64 ObjectId); TraceServices::IAnalysisSession& Session; TMap ObjectIdToChooserEvaluationTimelines; TArray>> ChooserEvaluationTimelines; TArray>> ChooserValueTimelines; };