//
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using System.Runtime.CompilerServices;
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
///
///
/// Allocator context object for a lock free hash map that allocates a larger memory block at once and hands it
/// out in smaller portions. This avoids contention on the atomic LFHMAllocator::mWriteOffset.
///
///
/// C++:
/// Jolt/Core/LockFreeHashMap.h:48
///
/// class LFHMAllocatorContext : public NonCopyable
///
///
[InteropHandle]
public readonly partial struct LFHMAllocatorContext : IDisposable
{
///
///
/// Construct a new allocator context
///
///
/// C++:
/// Jolt/Core/LockFreeHashMap.h:52
///
/// inline LFHMAllocatorContext(LFHMAllocator &inAllocator, uint32 inBlockSize)
///
///
public static LFHMAllocatorContext Create(LFHMAllocator allocator, uint blockSize) =>
Jolt.PInvoke.LFHMAllocatorContext_Create(allocator, blockSize);
///
///
/// Allocate data block
///
///
/// C++:
/// Jolt/Core/LockFreeHashMap.h:59
///
/// inline bool Allocate(uint32 inSize, uint32 inAlignment, uint32 &outWriteOffset)
///
///
///
///
/// @brief Allocate data block
/// @param inSize Size of block to allocate.
/// @param inAlignment Alignment of block to allocate.
/// @param outWriteOffset Offset in buffer where block is located
/// @return True if allocation succeeded
///
///
public bool Allocate(uint size, uint alignment, out uint writeOffset) =>
Jolt.PInvoke.LFHMAllocatorContext_Allocate(this, size, alignment, out writeOffset);
public void Dispose() => Jolt.PInvoke.LFHMAllocatorContext_Destroy(this);
}
}