DragonECS-Graphs/src/Utils/Rel.cs

49 lines
1.4 KiB
C#
Raw Normal View History

2024-01-29 17:40:38 +08:00
using System;
using System.Runtime.CompilerServices;
2024-01-26 21:56:03 +08:00
namespace DCFApixels.DragonECS
{
2024-01-29 17:40:38 +08:00
public readonly ref struct StartRelEnd
2024-01-26 21:56:03 +08:00
{
/// <summary>Start vertex entity ID.</summary>
public readonly int start;
2024-01-29 17:40:38 +08:00
/// <summary>Relation entity ID.</summary>
public readonly int rel;
2024-01-26 21:56:03 +08:00
/// <summary>End vertex entity ID.</summary>
public readonly int end;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2024-01-29 17:40:38 +08:00
public StartRelEnd(int start, int rel, int end)
2024-01-26 21:56:03 +08:00
{
this.start = start;
2024-01-29 17:40:38 +08:00
this.rel = rel;
2024-01-26 21:56:03 +08:00
this.end = end;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2024-01-29 17:40:38 +08:00
public void Deconstruct(out int start, out int rel, out int end)
2024-01-26 21:56:03 +08:00
{
start = this.start;
2024-01-29 17:40:38 +08:00
rel = this.rel;
2024-01-26 21:56:03 +08:00
end = this.end;
}
}
2024-01-29 17:40:38 +08:00
public readonly ref struct RelEnd
2024-01-26 21:56:03 +08:00
{
2024-01-29 17:40:38 +08:00
/// <summary>Relation entity ID.</summary>
public readonly int rel;
2024-01-26 21:56:03 +08:00
/// <summary>End vertex entity ID.</summary>
public readonly int end;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2024-01-29 17:40:38 +08:00
public RelEnd(int rel, int end)
2024-01-26 21:56:03 +08:00
{
2024-01-29 17:40:38 +08:00
this.rel = rel;
2024-01-26 21:56:03 +08:00
this.end = end;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2024-01-29 17:40:38 +08:00
public void Deconstruct(out int rel, out int end)
2024-01-26 21:56:03 +08:00
{
2024-01-29 17:40:38 +08:00
rel = this.rel;
2024-01-26 21:56:03 +08:00
end = this.end;
}
}
}