feat: add bounded visualization snapshots
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
|
||||
namespace TrajectoryPlanningVisualization;
|
||||
|
||||
public sealed class PlanningVisualizationOptions
|
||||
{
|
||||
public int Port { get; set; } = 0;
|
||||
public int RefreshRateHz { get; set; } = 10;
|
||||
public int HistoryCycleLimit { get; set; } = 60;
|
||||
|
||||
public PlanningVisualizationOptionsSnapshot CreateValidatedSnapshot()
|
||||
{
|
||||
if (Port < 0 || Port > 65535)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(Port), "Port must be in the range 0 to 65535.");
|
||||
}
|
||||
|
||||
if (RefreshRateHz <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(RefreshRateHz), "Refresh rate must be positive.");
|
||||
}
|
||||
|
||||
if (HistoryCycleLimit <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(HistoryCycleLimit), "History cycle limit must be positive.");
|
||||
}
|
||||
|
||||
return new PlanningVisualizationOptionsSnapshot(Port, RefreshRateHz, HistoryCycleLimit);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class PlanningVisualizationOptionsSnapshot
|
||||
{
|
||||
internal PlanningVisualizationOptionsSnapshot(int port, int refreshRateHz, int historyCycleLimit)
|
||||
{
|
||||
Port = port;
|
||||
RefreshRateHz = refreshRateHz;
|
||||
HistoryCycleLimit = historyCycleLimit;
|
||||
}
|
||||
|
||||
public int Port { get; }
|
||||
public int RefreshRateHz { get; }
|
||||
public int HistoryCycleLimit { get; }
|
||||
public int MaximumClients => 2;
|
||||
}
|
||||
Reference in New Issue
Block a user