Files
ntwain/NTwain/IMemoryManager.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2014-04-05 16:48:44 -04:00
using System;
namespace NTwain
{
/// <summary>
/// Interface that provides the correct methods for managing memory on data exchanged with TWAIN sources.
/// </summary>
public interface IMemoryManager
{
/// <summary>
2014-04-05 18:33:21 -04:00
/// Function to allocate memory. Calls to this must be coupled with <see cref="Free"/> later.
2014-04-05 16:48:44 -04:00
/// </summary>
/// <param name="size">The size in bytes.</param>
/// <returns>Handle to the allocated memory.</returns>
2014-04-05 18:33:21 -04:00
IntPtr Allocate(uint size);
2014-04-05 16:48:44 -04:00
/// <summary>
/// Function to free memory.
/// </summary>
2014-04-05 18:33:21 -04:00
/// <param name="handle">The handle from <see cref="Allocate"/>.</param>
void Free(IntPtr handle);
2014-04-05 16:48:44 -04:00
/// <summary>
2014-04-05 18:33:21 -04:00
/// Function to lock some memory. Calls to this must be coupled with <see cref="Unlock"/> later.
2014-04-05 16:48:44 -04:00
/// </summary>
/// <param name="handle">The handle to allocated memory.</param>
/// <returns>Handle to the lock.</returns>
2014-04-05 18:33:21 -04:00
IntPtr Lock(IntPtr handle);
2014-04-05 16:48:44 -04:00
/// <summary>
/// Function to unlock a previously locked memory region.
/// </summary>
2014-04-05 18:33:21 -04:00
/// <param name="handle">The handle from <see cref="Lock"/>.</param>
void Unlock(IntPtr handle);
2014-04-05 16:48:44 -04:00
}
}