//
// 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 for temporary allocations. This allocator works as a stack: The blocks must always be freed in the
/// reverse order as they are allocated. Note that allocations and frees can take place from different threads,
/// but the order is guaranteed though job dependencies, so it is not needed to use any form of locking.
///
///
/// C++:
/// Jolt/Core/TempAllocator.h:15
///
/// class TempAllocator : public NonCopyable
///
///
[InteropHandle]
public readonly partial struct TempAllocator
{
///
///
/// Allocates inSize bytes of memory, returned memory address must be JPH_RVECTOR_ALIGNMENT byte aligned
///
///
/// C++:
/// Jolt/Core/TempAllocator.h:27
///
/// virtual void * Allocate(uint inSize) = 0
///
///
public unsafe Ptr Allocate(ByteSize size) => Jolt.PInvoke.TempAllocator_Allocate(this, (uint)size);
///
///
/// Frees inSize bytes of memory located at inAddress
///
///
/// C++:
/// Jolt/Core/TempAllocator.h:30
///
/// virtual void Free(void *inAddress, uint inSize) = 0
///
///
public unsafe void Free(Ptr address, ByteSize size) =>
Jolt.PInvoke.TempAllocator_Free(this, address, (uint)size);
///
///
/// If this allocator needs to fall back to aligned allocations because JPH_RVECTOR_ALIGNMENT is bigger than
/// the platform default
///
///
/// C++:
/// Jolt/Core/TempAllocator.h:21
///
/// static constexpr bool needs_aligned_allocate = JPH_RVECTOR_ALIGNMENT > JPH_DEFAULT_ALLOCATE_ALIGNMENT
///
///
public static bool GetNeeds_aligned_allocate() => Jolt.PInvoke.TempAllocator_GetNeeds_aligned_allocate();
}
}