From e74d94e268998a5a13116e396abcbb377d515c3e Mon Sep 17 00:00:00 2001 From: ig Date: Sun, 26 Feb 2023 15:43:53 +0100 Subject: [PATCH] Add missing .generated.cs files. --- csharp/InnovEnergy.sln | 1 + csharp/Lib/Units/Angle.generated.cs | 46 +++++++++++++++++++++ csharp/Lib/Units/Current.cs | 20 +++++++++ csharp/Lib/Units/Current.generated.cs | 46 +++++++++++++++++++++ csharp/Lib/Units/Frequency.generated.cs | 46 +++++++++++++++++++++ csharp/Lib/Units/ReactivePower.generated.cs | 46 +++++++++++++++++++++ csharp/Lib/Units/Resistance.generated.cs | 46 +++++++++++++++++++++ csharp/Lib/Units/Temperature.generated.cs | 46 +++++++++++++++++++++ csharp/Lib/Units/Voltage.generated.cs | 46 +++++++++++++++++++++ 9 files changed, 343 insertions(+) create mode 100644 csharp/Lib/Units/Angle.generated.cs create mode 100644 csharp/Lib/Units/Current.cs create mode 100644 csharp/Lib/Units/Current.generated.cs create mode 100644 csharp/Lib/Units/Frequency.generated.cs create mode 100644 csharp/Lib/Units/ReactivePower.generated.cs create mode 100644 csharp/Lib/Units/Resistance.generated.cs create mode 100644 csharp/Lib/Units/Temperature.generated.cs create mode 100644 csharp/Lib/Units/Voltage.generated.cs diff --git a/csharp/InnovEnergy.sln b/csharp/InnovEnergy.sln index 3a0fa6fcd..8d368b9cb 100644 --- a/csharp/InnovEnergy.sln +++ b/csharp/InnovEnergy.sln @@ -69,6 +69,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Meta", "Meta", "{AED84693-C App\InnovEnergy.App.props = App\InnovEnergy.App.props Lib\InnovEnergy.Lib.props = Lib\InnovEnergy.Lib.props InnovEnergy.sln.DotSettings = InnovEnergy.sln.DotSettings + ..\.gitignore = ..\.gitignore EndProjectSection EndProject diff --git a/csharp/Lib/Units/Angle.generated.cs b/csharp/Lib/Units/Angle.generated.cs new file mode 100644 index 000000000..77f634fd3 --- /dev/null +++ b/csharp/Lib/Units/Angle.generated.cs @@ -0,0 +1,46 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. + +namespace InnovEnergy.Lib.Units; + +using T = Angle; + +public readonly partial struct Angle +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Current.cs b/csharp/Lib/Units/Current.cs new file mode 100644 index 000000000..d2d674d04 --- /dev/null +++ b/csharp/Lib/Units/Current.cs @@ -0,0 +1,20 @@ +using InnovEnergy.Lib.Units.Generator; + +namespace InnovEnergy.Lib.Units; + + +[Generate] +public readonly partial struct Current +{ + public static String Unit => "A"; + public static String Symbol => "I"; + + public Current(Decimal value) => Value = value; + + // P=UI + public static Power operator *(Current current, Voltage voltage) => new Power(current.Value * voltage.Value); + + // U=RI + public static Voltage operator *(Current current, Resistance resistance) => new Voltage(resistance.Value* current.Value); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Current.generated.cs b/csharp/Lib/Units/Current.generated.cs new file mode 100644 index 000000000..bc1964810 --- /dev/null +++ b/csharp/Lib/Units/Current.generated.cs @@ -0,0 +1,46 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. + +namespace InnovEnergy.Lib.Units; + +using T = Current; + +public readonly partial struct Current +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Frequency.generated.cs b/csharp/Lib/Units/Frequency.generated.cs new file mode 100644 index 000000000..2959bdbc4 --- /dev/null +++ b/csharp/Lib/Units/Frequency.generated.cs @@ -0,0 +1,46 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. + +namespace InnovEnergy.Lib.Units; + +using T = Frequency; + +public readonly partial struct Frequency +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/ReactivePower.generated.cs b/csharp/Lib/Units/ReactivePower.generated.cs new file mode 100644 index 000000000..20a55cccc --- /dev/null +++ b/csharp/Lib/Units/ReactivePower.generated.cs @@ -0,0 +1,46 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. + +namespace InnovEnergy.Lib.Units; + +using T = Power; + +public readonly partial struct Power +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Resistance.generated.cs b/csharp/Lib/Units/Resistance.generated.cs new file mode 100644 index 000000000..9a715bf51 --- /dev/null +++ b/csharp/Lib/Units/Resistance.generated.cs @@ -0,0 +1,46 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. + +namespace InnovEnergy.Lib.Units; + +using T = Resistance; + +public readonly partial struct Resistance +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Temperature.generated.cs b/csharp/Lib/Units/Temperature.generated.cs new file mode 100644 index 000000000..1c87f4c31 --- /dev/null +++ b/csharp/Lib/Units/Temperature.generated.cs @@ -0,0 +1,46 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. + +namespace InnovEnergy.Lib.Units; + +using T = Temperature; + +public readonly partial struct Temperature +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} \ No newline at end of file diff --git a/csharp/Lib/Units/Voltage.generated.cs b/csharp/Lib/Units/Voltage.generated.cs new file mode 100644 index 000000000..d64264d60 --- /dev/null +++ b/csharp/Lib/Units/Voltage.generated.cs @@ -0,0 +1,46 @@ +#nullable enable // Auto-generated code requires an explicit '#nullable' directive in source. + +namespace InnovEnergy.Lib.Units; + +using T = Voltage; + +public readonly partial struct Voltage +{ + public Decimal Value { get; } + public override String ToString() => Value + Unit; + + // scalar multiplication + + public static T operator *(Decimal scalar, T t) => new T(scalar * t.Value); + public static T operator *(T t, Decimal scalar) => new T(scalar * t.Value); + public static T operator /(T t, Decimal scalar) => new T(t.Value / scalar); + + // addition + + public static T operator +(T left, T right) => new T(left.Value + right.Value); + public static T operator -(T left, T right) => new T(left.Value - right.Value); + public static T operator -(T t) => new T(-t.Value); + + // compare + + public static Boolean operator ==(T left, T right) => left.Value == right.Value; + public static Boolean operator !=(T left, T right) => left.Value != right.Value; + public static Boolean operator > (T left, T right) => left.Value > right.Value; + public static Boolean operator < (T left, T right) => left.Value < right.Value; + public static Boolean operator >=(T left, T right) => left.Value >= right.Value; + public static Boolean operator <=(T left, T right) => left.Value <= right.Value; + + // conversion + + public static implicit operator T(Decimal d) => new T(d); + public static implicit operator T(Double d) => new T((Decimal)d); + public static implicit operator T(Int32 i) => new T(i); + public static implicit operator Decimal(T t) => t.Value; + + // equality + + public Boolean Equals(T other) => Value == other.Value; + public override Boolean Equals(Object? obj) => obj is T other && Equals(other); + public override Int32 GetHashCode() => Value.GetHashCode(); + +} \ No newline at end of file