using System; using System.Collections; using System.Collections.Generic; using Unity.Simulation; using UnityEngine.Perception.GroundTruth.DataModel; namespace UnityEngine.Perception.GroundTruth { public abstract class ConsumerEndpoint { IEnumerator WaitForComplete() { yield return new WaitUntil(IsComplete); } #if false public virtual bool IsComplete => true; #else protected abstract bool IsComplete(); #endif /// /// Called when the simulation begins. Provides simulation wide metadata to /// the consumer. /// /// Metadata describing the active simulation public abstract void OnSimulationStarted(SimulationMetadata metadata); public virtual void OnSensorRegistered(SensorDefinition sensor) { } public virtual void OnAnnotationRegistered(AnnotationDefinition annotationDefinition) { } public virtual void OnMetricRegistered(MetricDefinition metricDefinition) { } /// /// Called at the end of each frame. Contains all of the generated data for the /// frame. This method is called after the frame has entirely finished processing. /// /// The frame data. public abstract void OnFrameGenerated(Frame frame); /// /// Called at the end of the simulation. Contains metadata describing the entire /// simulation process. /// /// Metadata describing the entire simulation process public abstract void OnSimulationCompleted(CompletionMetadata metadata); } }