Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using CeresSharp.Native;
|
||||
using CeresSharp.Native.SafeHandles;
|
||||
|
||||
namespace CeresSharp.Advanced;
|
||||
|
||||
/// <summary>
|
||||
/// Context for performance optimization.
|
||||
/// Allows reuse of expensive objects across multiple solves.
|
||||
/// </summary>
|
||||
public sealed class Context : IDisposable
|
||||
{
|
||||
private readonly ContextHandle _handle;
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Context instance.
|
||||
/// </summary>
|
||||
public Context()
|
||||
{
|
||||
_handle = ContextHandle.Create();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the native handle.
|
||||
/// </summary>
|
||||
internal ContextHandle Handle => _handle;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
_handle?.Dispose();
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user