brutal/Brutal.Jolt/Generated/Classes/LFHMAllocatorContext.gen.cs
Rian Drake b578433e37 first
2026-10-15 17:10:50 +13:00

65 lines
2.7 KiB
C#

// <auto-generated/>
// 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
{
/// <summary>
/// <para>
/// 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.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/LockFreeHashMap.h#L48">Jolt/Core/LockFreeHashMap.h:48</see>
/// <br/>
/// <c>class LFHMAllocatorContext : public NonCopyable</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct LFHMAllocatorContext : IDisposable
{
/// <summary>
/// <para>
/// Construct a new allocator context
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/LockFreeHashMap.h#L52">Jolt/Core/LockFreeHashMap.h:52</see>
/// <br/>
/// <c>inline LFHMAllocatorContext(LFHMAllocator &amp;inAllocator, uint32 inBlockSize)</c>
/// </para>
/// </summary>
public static LFHMAllocatorContext Create(LFHMAllocator allocator, uint blockSize) =>
Jolt.PInvoke.LFHMAllocatorContext_Create(allocator, blockSize);
/// <summary>
/// <para>
/// Allocate data block
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/LockFreeHashMap.h#L59">Jolt/Core/LockFreeHashMap.h:59</see>
/// <br/>
/// <c>inline bool Allocate(uint32 inSize, uint32 inAlignment, uint32 &amp;outWriteOffset)</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// @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
/// </code>
/// </remarks>
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);
}
}