generated from CareBoo/UPMTemplate-2020
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transactiongroup): add generic methods for constructing `Transac…
…tionGroup` re #126
- Loading branch information
1 parent
52dea5f
commit 5e4b6aa
Showing
5 changed files
with
295 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
218 changes: 218 additions & 0 deletions
218
Runtime/CareBoo.AlgoSdk/Transaction/TransactionGroup/TransactionGroup.Generic.gen.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
|
||
namespace AlgoSdk | ||
{ | ||
public partial struct TransactionGroup | ||
{ | ||
public static TransactionGroup Of<T0>(in T0 txn0) | ||
where T0 : IEquatable<T0>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1>(in T0 txn0, in T1 txn1) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2>(in T0 txn0, in T1 txn1, in T2 txn2) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7, T8>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7, in T8 txn8) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
where T8 : IEquatable<T8>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId(), txn8.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7, in T8 txn8, in T9 txn9) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
where T8 : IEquatable<T8>, ITransaction | ||
where T9 : IEquatable<T9>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId(), txn8.GetId(), txn9.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7, in T8 txn8, in T9 txn9, in T10 txn10) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
where T8 : IEquatable<T8>, ITransaction | ||
where T9 : IEquatable<T9>, ITransaction | ||
where T10 : IEquatable<T10>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId(), txn8.GetId(), txn9.GetId(), txn10.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7, in T8 txn8, in T9 txn9, in T10 txn10, in T11 txn11) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
where T8 : IEquatable<T8>, ITransaction | ||
where T9 : IEquatable<T9>, ITransaction | ||
where T10 : IEquatable<T10>, ITransaction | ||
where T11 : IEquatable<T11>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId(), txn8.GetId(), txn9.GetId(), txn10.GetId(), txn11.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7, in T8 txn8, in T9 txn9, in T10 txn10, in T11 txn11, in T12 txn12) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
where T8 : IEquatable<T8>, ITransaction | ||
where T9 : IEquatable<T9>, ITransaction | ||
where T10 : IEquatable<T10>, ITransaction | ||
where T11 : IEquatable<T11>, ITransaction | ||
where T12 : IEquatable<T12>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId(), txn8.GetId(), txn9.GetId(), txn10.GetId(), txn11.GetId(), txn12.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7, in T8 txn8, in T9 txn9, in T10 txn10, in T11 txn11, in T12 txn12, in T13 txn13) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
where T8 : IEquatable<T8>, ITransaction | ||
where T9 : IEquatable<T9>, ITransaction | ||
where T10 : IEquatable<T10>, ITransaction | ||
where T11 : IEquatable<T11>, ITransaction | ||
where T12 : IEquatable<T12>, ITransaction | ||
where T13 : IEquatable<T13>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId(), txn8.GetId(), txn9.GetId(), txn10.GetId(), txn11.GetId(), txn12.GetId(), txn13.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7, in T8 txn8, in T9 txn9, in T10 txn10, in T11 txn11, in T12 txn12, in T13 txn13, in T14 txn14) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
where T8 : IEquatable<T8>, ITransaction | ||
where T9 : IEquatable<T9>, ITransaction | ||
where T10 : IEquatable<T10>, ITransaction | ||
where T11 : IEquatable<T11>, ITransaction | ||
where T12 : IEquatable<T12>, ITransaction | ||
where T13 : IEquatable<T13>, ITransaction | ||
where T14 : IEquatable<T14>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId(), txn8.GetId(), txn9.GetId(), txn10.GetId(), txn11.GetId(), txn12.GetId(), txn13.GetId(), txn14.GetId()); | ||
} | ||
public static TransactionGroup Of<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(in T0 txn0, in T1 txn1, in T2 txn2, in T3 txn3, in T4 txn4, in T5 txn5, in T6 txn6, in T7 txn7, in T8 txn8, in T9 txn9, in T10 txn10, in T11 txn11, in T12 txn12, in T13 txn13, in T14 txn14, in T15 txn15) | ||
where T0 : IEquatable<T0>, ITransaction | ||
where T1 : IEquatable<T1>, ITransaction | ||
where T2 : IEquatable<T2>, ITransaction | ||
where T3 : IEquatable<T3>, ITransaction | ||
where T4 : IEquatable<T4>, ITransaction | ||
where T5 : IEquatable<T5>, ITransaction | ||
where T6 : IEquatable<T6>, ITransaction | ||
where T7 : IEquatable<T7>, ITransaction | ||
where T8 : IEquatable<T8>, ITransaction | ||
where T9 : IEquatable<T9>, ITransaction | ||
where T10 : IEquatable<T10>, ITransaction | ||
where T11 : IEquatable<T11>, ITransaction | ||
where T12 : IEquatable<T12>, ITransaction | ||
where T13 : IEquatable<T13>, ITransaction | ||
where T14 : IEquatable<T14>, ITransaction | ||
where T15 : IEquatable<T15>, ITransaction | ||
{ | ||
return TransactionGroup.Of(txn0.GetId(), txn1.GetId(), txn2.GetId(), txn3.GetId(), txn4.GetId(), txn5.GetId(), txn6.GetId(), txn7.GetId(), txn8.GetId(), txn9.GetId(), txn10.GetId(), txn11.GetId(), txn12.GetId(), txn13.GetId(), txn14.GetId(), txn15.GetId()); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Runtime/CareBoo.AlgoSdk/Transaction/TransactionGroup/TransactionGroup.Generic.gen.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
Runtime/CareBoo.AlgoSdk/Transaction/TransactionGroup/TransactionGroup.Generic.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<#@ assembly name="System.Core" #> | ||
<#@ output extension=".gen.cs" #> | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
|
||
namespace AlgoSdk | ||
{ | ||
public partial struct TransactionGroup | ||
{ | ||
<# | ||
var MAX_SIZE = 16; | ||
var GENERIC_DEF = ""; | ||
var ARGS = ""; | ||
var CONSTRAINTS = ""; | ||
var CALL_ARGS = ""; | ||
for (var i = 0; i < MAX_SIZE; i++) | ||
{ | ||
var typeName = "T" + i.ToString(); | ||
var fieldName = "txn" + i.ToString(); | ||
|
||
if (i > 0) GENERIC_DEF += ", "; | ||
GENERIC_DEF += typeName; | ||
|
||
if (i > 0) ARGS += ", "; | ||
ARGS += "in " + typeName + " " + fieldName; | ||
|
||
if (i > 0) CONSTRAINTS += "\n "; | ||
CONSTRAINTS += "where " + typeName + " : IEquatable<" + typeName + ">, ITransaction"; | ||
|
||
if (i > 0) CALL_ARGS += ", "; | ||
CALL_ARGS += fieldName + ".GetId()"; | ||
#> | ||
public static TransactionGroup Of<<#=GENERIC_DEF#>>(<#=ARGS#>) | ||
<#=CONSTRAINTS#> | ||
{ | ||
return TransactionGroup.Of(<#=CALL_ARGS#>); | ||
} | ||
<# | ||
} | ||
#> | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Runtime/CareBoo.AlgoSdk/Transaction/TransactionGroup/TransactionGroup.Generic.tt.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.