public static unsafe void Map(Type vertexType, int index, VertexSpecialField specialField) { var typeData = VertexMarshalHelper.GetVertexTypeData(vertexType); var field = typeData.GetField(specialField); MapPrivate(index, field, typeData.VertexSize); }
public VertexFieldData GetField(VertexSpecialField specialField) { if (TryGetField(specialField, out var field) == false) { ThrowSpecialFieldNotFound(specialField); } return(field); }
public bool TryGetField(VertexSpecialField specialField, [MaybeNullWhen(false)] out VertexFieldData field) { foreach (var f in _fields) { if (f.SpecialField == specialField) { field = f; return(true); } } field = null; return(false); }
private static void ThrowSpecialFieldNotFound(VertexSpecialField specialField) => throw new InvalidOperationException($"The special field is not found. (Special Field: {specialField})");
public static unsafe void Map <TVertex>(int index, VertexSpecialField specialField) where TVertex : unmanaged { Map(typeof(TVertex), index, specialField); }
public void Map(Type vertexType, int index, VertexSpecialField specialField) { if (vertexType is null) { ThrowNullArg();