blob: 2544a9dd6f34435055238ae8b1eab5eb9af6aa80 [file] [log] [blame]
using System;
using System.Runtime.InteropServices;
namespace Apache
{
namespace Geode
{
namespace DotNetCore
{
public class Pool : GemfireNativeObject
{
[DllImport(Constants.libPath,
CharSet = CharSet.Auto)]
private static extern IntPtr apache_geode_Cache_GetPoolManager(IntPtr cache);
[DllImport(Constants.libPath,
CharSet = CharSet.Auto)]
private static extern IntPtr apache_geode_PoolFactory_CreatePool(IntPtr poolFactory, IntPtr poolName);
[DllImport(Constants.libPath,
CharSet = CharSet.Auto)]
private static extern void apache_geode_DestroyPool(IntPtr pool);
internal Pool(IntPtr poolFactory, string poolName)
{
IntPtr poolNamePtr = Marshal.StringToCoTaskMemUTF8(poolName);
_containedObject = apache_geode_PoolFactory_CreatePool(poolFactory, poolNamePtr);
Marshal.FreeCoTaskMem(poolNamePtr);
}
protected override void DestroyContainedObject()
{
apache_geode_DestroyPool(_containedObject);
_containedObject = IntPtr.Zero;
}
}
}
}
}