31 lines
817 B
C#
31 lines
817 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace MultiWheelC.TrajectoryPlanning.EMPlanner;
|
|
|
|
public sealed class EmPlanningDiagnostics
|
|
{
|
|
private readonly List<string> _debugSinkFailures = new List<string>();
|
|
|
|
public IReadOnlyList<string> DebugSinkFailures
|
|
{
|
|
get { return new ReadOnlyCollection<string>(new List<string>(_debugSinkFailures)); }
|
|
}
|
|
|
|
public void WriteDebug(EmPlannerDebugOptions options, string message)
|
|
{
|
|
if (options == null || options.Sink == null)
|
|
return;
|
|
|
|
try
|
|
{
|
|
options.Sink.Write(message ?? string.Empty);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
_debugSinkFailures.Add(exception.GetType().FullName + ": " + exception.Message);
|
|
}
|
|
}
|
|
}
|