DeviceDependentGenerator extended to allow generation of enum dependent templates. Name suffix separate to its own attribute.
This commit is contained in:
1 parent
a21ab3134e
commit
d32eea0212
5 files changed
+375
-112
No files matched your search
@@ -19,7 +19,19 @@ public sealed class DeviceDependentGeneratorTests
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class DeviceDependentTemplateAttribute : Attribute
|
||||
{
|
||||
public DeviceDependentTemplateAttribute(Type enumType, string? suffix = null) { }
|
||||
public DeviceDependentTemplateAttribute(Type enumType) { }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = true)]
|
||||
public sealed class EnumDependentTemplateAttribute : Attribute
|
||||
{
|
||||
public EnumDependentTemplateAttribute(Type enumType) { }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class NameSuffixAttribute : Attribute
|
||||
{
|
||||
public NameSuffixAttribute(string suffix) { }
|
||||
}
|
||||
|
||||
public enum CalculationDevice
|
||||
@@ -35,7 +47,8 @@ public sealed class DeviceDependentGeneratorTests
|
||||
|
||||
namespace PerfectNumbers.Core;
|
||||
|
||||
[DeviceDependentTemplate(typeof(CalculationDevice), suffix: "Impl")]
|
||||
[DeviceDependentTemplate(typeof(CalculationDevice))]
|
||||
[NameSuffix("Impl")]
|
||||
public static class PrimeCalculatorTemplate
|
||||
{
|
||||
#if DEVICE_CPU
|
||||
|
||||
Reference in new issue
Block a user