ntwain/NTwain/IMemoryManager.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2014-04-06 04:48:44 +08: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-06 06:33:21 +08:00
/// Function to allocate memory. Calls to this must be coupled with <see cref="Free"/> later.
2014-04-06 04:48:44 +08:00
/// </summary>
/// <param name="size">The size in bytes.</param>
/// <returns>Handle to the allocated memory.</returns>
2014-04-06 06:33:21 +08:00
IntPtr Allocate(uint size);
2014-04-06 04:48:44 +08:00
/// <summary>
/// Function to free memory.
/// </summary>
2014-04-06 06:33:21 +08:00
/// <param name="handle">The handle from <see cref="Allocate"/>.</param>
void Free(IntPtr handle);
2014-04-06 04:48:44 +08:00
/// <summary>
2014-04-06 06:33:21 +08:00
/// Function to lock some memory. Calls to this must be coupled with <see cref="Unlock"/> later.
2014-04-06 04:48:44 +08:00
/// </summary>
/// <param name="handle">The handle to allocated memory.</param>
/// <returns>Handle to the lock.</returns>
2014-04-06 06:33:21 +08:00
IntPtr Lock(IntPtr handle);
2014-04-06 04:48:44 +08:00
/// <summary>
/// Function to unlock a previously locked memory region.
/// </summary>
/// <param name="handle">The same handle passed <see cref="Lock"/>.</param>
2014-04-06 06:33:21 +08:00
void Unlock(IntPtr handle);
2014-04-06 04:48:44 +08:00
}
}