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