46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
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;
|
|
}
|