//
// 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
{
///
///
/// Implementation of the TempAllocator that tries to allocate from a large preallocated block, but falls back
/// to malloc when it is exhausted
///
///
/// C++:
/// Jolt/Core/TempAllocator.h:168
///
/// class TempAllocatorImplWithMallocFallback final : public TempAllocator
///
///
[InteropHandle]
public readonly partial struct TempAllocatorImplWithMallocFallback : IDisposable
{
///
///
/// Constructs the allocator with an initial fixed block if inSize
///
///
/// C++:
/// Jolt/Core/TempAllocator.h:174
///
/// explicit TempAllocatorImplWithMallocFallback(uint inSize)
///
///
public static TempAllocatorImplWithMallocFallback Create(uint size) =>
Jolt.PInvoke.TempAllocatorImplWithMallocFallback_Create(size);
///
///
/// See: TempAllocator
///
///
/// C++:
/// Jolt/Core/TempAllocator.h:180
///
/// virtual void * Allocate(uint inSize) override
///
///
public unsafe Ptr Allocate(uint size) => Jolt.PInvoke.TempAllocatorImplWithMallocFallback_Allocate(this, size);
///
///
/// See: TempAllocator
///
///
/// C++:
/// Jolt/Core/TempAllocator.h:189
///
/// virtual void Free(void *inAddress, uint inSize) override
///
///
public unsafe void Free(Ptr address, uint size) =>
Jolt.PInvoke.TempAllocatorImplWithMallocFallback_Free(this, address, size);
public static implicit operator TempAllocator(TempAllocatorImplWithMallocFallback value) =>
Unsafe.BitCast(value);
public void Dispose() => Jolt.PInvoke.TempAllocatorImplWithMallocFallback_Destroy(this);
///
public unsafe Ptr Allocate(ByteSize size) => ((TempAllocator)this).Allocate(size);
///
public unsafe void Free(Ptr address, ByteSize size) => ((TempAllocator)this).Free(address, size);
}
}