brutal/brutal.jolt/Brutal.Jolt/Generated/Classes/RTTI.gen.cs
2026-10-15 14:12:02 +13:00

315 lines
12 KiB
C#

// <auto-generated/>
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L121">Jolt/Core/RTTI.h:121</see>
/// <br/>
/// <c>class RTTI</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Light weight runtime type information system. This way we don't need to turn
/// on the default RTTI system of the compiler (introducing a possible overhead for every
/// class)
///
/// Notes:
/// - An extra virtual member function is added. This adds 8 bytes to the size of
/// an instance of the class (unless you are already using virtual functions).
///
/// To use RTTI on a specific class use:
///
/// Header file:
///
/// class Foo
/// {
/// JPH_DECLARE_RTTI_VIRTUAL_BASE(Foo)
/// }
///
/// class Bar : public Foo
/// {
/// JPH_DECLARE_RTTI_VIRTUAL(Bar)
/// };
///
/// Implementation file:
///
/// JPH_IMPLEMENT_RTTI_VIRTUAL_BASE(Foo)
/// {
/// }
///
/// JPH_IMPLEMENT_RTTI_VIRTUAL(Bar)
/// {
/// JPH_ADD_BASE_CLASS(Bar, Foo) // Multiple inheritance is allowed, just do JPH_ADD_BASE_CLASS for every base class
/// }
///
/// For abstract classes use:
///
/// Header file:
///
/// class Foo
/// {
/// JPH_DECLARE_RTTI_ABSTRACT_BASE(Foo)
///
/// public:
/// virtual void AbstractFunction() = 0;
/// }
///
/// class Bar : public Foo
/// {
/// JPH_DECLARE_RTTI_VIRTUAL(Bar)
///
/// public:
/// virtual void AbstractFunction() { } // Function is now implemented so this class is no longer abstract
/// };
///
/// Implementation file:
///
/// JPH_IMPLEMENT_RTTI_ABSTRACT_BASE(Foo)
/// {
/// }
///
/// JPH_IMPLEMENT_RTTI_VIRTUAL(Bar)
/// {
/// JPH_ADD_BASE_CLASS(Bar, Foo)
/// }
///
/// Example of usage in a program:
///
/// Foo *foo_ptr = new Foo;
/// Foo *bar_ptr = new Bar;
///
/// IsType(foo_ptr, RTTI(Bar)) returns false
/// IsType(bar_ptr, RTTI(Bar)) returns true
///
/// IsKindOf(foo_ptr, RTTI(Bar)) returns false
/// IsKindOf(bar_ptr, RTTI(Foo)) returns true
/// IsKindOf(bar_ptr, RTTI(Bar)) returns true
///
/// StaticCast&amp;lt;Bar&amp;gt;(foo_ptr) asserts and returns foo_ptr casted to Bar *
/// StaticCast&amp;lt;Bar&amp;gt;(bar_ptr) returns bar_ptr casted to Bar *
///
/// DynamicCast&amp;lt;Bar&amp;gt;(foo_ptr) returns nullptr
/// DynamicCast&amp;lt;Bar&amp;gt;(bar_ptr) returns bar_ptr casted to Bar *
///
/// Other feature of DynamicCast:
///
/// class A { int data[5]; };
/// class B { int data[7]; };
/// class C : public A, public B { int data[9]; };
///
/// C *c = new C;
/// A *a = c;
///
/// Note that:
///
/// B *b = (B *)a;
///
/// generates an invalid pointer,
///
/// B *b = StaticCast&amp;lt;B&amp;gt;(a);
///
/// doesn't compile, and
///
/// B *b = DynamicCast&amp;lt;B&amp;gt;(a);
///
/// does the correct cast
/// </code>
/// </remarks>
[InteropHandle]
public readonly partial struct RTTI
{
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L174">Jolt/Core/RTTI.h:174</see>
/// <br/>
/// <c>struct BaseClass</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Base class information
/// </para>
/// </remarks>
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct BaseClass
{
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L176">Jolt/Core/RTTI.h:176</see>
/// <br/>
/// <c>const RTTI * mRTTI</c>
/// </para>
/// </summary>
[FieldOffset(0)]
public RTTI mRTTI;
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L177">Jolt/Core/RTTI.h:177</see>
/// <br/>
/// <c>int mOffset</c>
/// </para>
/// </summary>
[FieldOffset(8)]
public int mOffset;
}
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L138">Jolt/Core/RTTI.h:138</see>
/// <br/>
/// <c>inline const char * GetName() const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Properties
/// </para>
/// </remarks>
public unsafe RefString8 GetName() => (Ptr<byte>)Jolt.PInvoke.RTTI_GetName(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L139">Jolt/Core/RTTI.h:139</see>
/// <br/>
/// <c>void SetName(const char *inName)</c>
/// </para>
/// </summary>
public unsafe void SetName(RefString8 name)
{
fixed (byte* name_fixed = name)
{
Jolt.PInvoke.RTTI_SetName(this, name_fixed);
}
}
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L140">Jolt/Core/RTTI.h:140</see>
/// <br/>
/// <c>inline int GetSize() const</c>
/// </para>
/// </summary>
public int GetSize() => Jolt.PInvoke.RTTI_GetSize(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L141">Jolt/Core/RTTI.h:141</see>
/// <br/>
/// <c>bool IsAbstract() const</c>
/// </para>
/// </summary>
public bool IsAbstract() => Jolt.PInvoke.RTTI_IsAbstract(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L142">Jolt/Core/RTTI.h:142</see>
/// <br/>
/// <c>int GetBaseClassCount() const</c>
/// </para>
/// </summary>
public int GetBaseClassCount() => Jolt.PInvoke.RTTI_GetBaseClassCount(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L143">Jolt/Core/RTTI.h:143</see>
/// <br/>
/// <c>const RTTI * GetBaseClass(int inIdx) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The returned handle is borrowed from its owner; don't Dispose it.
/// </para>
/// </remarks>
public RTTI GetBaseClass(int idx) => Jolt.PInvoke.RTTI_GetBaseClass(this, idx);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L144">Jolt/Core/RTTI.h:144</see>
/// <br/>
/// <c>uint32 GetHash() const</c>
/// </para>
/// </summary>
public uint GetHash() => Jolt.PInvoke.RTTI_GetHash(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L147">Jolt/Core/RTTI.h:147</see>
/// <br/>
/// <c>void * CreateObject() const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Create an object of this type (returns nullptr if the object is abstract)
/// </para>
/// </remarks>
public unsafe Ptr CreateObject() => Jolt.PInvoke.RTTI_CreateObject(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L150">Jolt/Core/RTTI.h:150</see>
/// <br/>
/// <c>void DestructObject(void *inObject) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Destruct object of this type (does nothing if the object is abstract)
/// </para>
/// </remarks>
public unsafe void DestructObject(Ptr @object) => Jolt.PInvoke.RTTI_DestructObject(this, @object);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L153">Jolt/Core/RTTI.h:153</see>
/// <br/>
/// <c>void AddBaseClass(const RTTI *inRTTI, int inOffset)</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Add base class
/// </para>
/// </remarks>
public void AddBaseClass(RTTI rTTI, int offset) => Jolt.PInvoke.RTTI_AddBaseClass(this, rTTI, offset);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L160">Jolt/Core/RTTI.h:160</see>
/// <br/>
/// <c>bool IsKindOf(const RTTI *inRTTI) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Test if this class is derived from class of type inRTTI
/// </para>
/// </remarks>
public bool IsKindOf(RTTI rTTI) => Jolt.PInvoke.RTTI_IsKindOf(this, rTTI);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/23dadd0e603f1b321142d4c74df07fce85064989/Jolt/Core/RTTI.h#L163">Jolt/Core/RTTI.h:163</see>
/// <br/>
/// <c>const void * CastTo(const void *inObject, const RTTI *inRTTI) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Cast inObject of this type to object of type inRTTI, returns nullptr if the cast is unsuccessful
/// </para>
/// </remarks>
public unsafe Ptr CastTo(Ptr @object, RTTI rTTI) => Jolt.PInvoke.RTTI_CastTo(this, @object, rTTI);
}
}