Initial commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using CeresSharp.Native;
|
||||
|
||||
namespace CeresSharp.Native.SafeHandles;
|
||||
|
||||
/// <summary>
|
||||
/// Safe handle for Ceres SolverSummary.
|
||||
/// </summary>
|
||||
internal sealed class SolverSummaryHandle : BaseSafeHandle
|
||||
{
|
||||
private SolverSummaryHandle() : base()
|
||||
{
|
||||
}
|
||||
|
||||
internal SolverSummaryHandle(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
|
||||
{
|
||||
}
|
||||
|
||||
public static SolverSummaryHandle Create()
|
||||
{
|
||||
var handle = CeresNative.ceres_wrapper_create_solver_summary();
|
||||
if (handle == IntPtr.Zero)
|
||||
{
|
||||
throw new Exceptions.CeresException(Exceptions.CeresErrorCode.OutOfMemory, "Failed to create solver summary");
|
||||
}
|
||||
return new SolverSummaryHandle(handle, true);
|
||||
}
|
||||
|
||||
protected override void ReleaseNativeHandle(IntPtr handle)
|
||||
{
|
||||
CeresNative.ceres_wrapper_free_solver_summary(handle);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user