From c3cbb123c8c8638ff74326bb94034328e0e9ca9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Sun, 19 Apr 2020 16:16:48 +0200 Subject: [PATCH] refactored codegen to use generated schema fixed issue #45 refactored codegen unit tests fixed appveyor.yml --- Capnp.Net.Runtime.Tests/ImpatientTests.cs | 4 + .../Mock/TestCapImplementations.cs | 2 +- Capnp.Net.Runtime.Tests/SerializationTests.cs | 2 + Capnp.Net.Runtime.Tests/TcpRpc.cs | 2 + Capnp.Net.Runtime.Tests/Util/TestBase.cs | 2 + Capnp.Net.Runtime/CapnpSerializable.cs | 11 + Capnp.Net.Runtime/Rpc/Impatient.cs | 2 +- Capnp.Net.Runtime/Rpc/NoResultsException.cs | 16 + .../Rpc/TailCallNoDataException.cs | 9 - .../CodeGenerator.feature | 3 +- .../CodeGenerator.feature.cs | 15 + .../CodeGeneratorUnitTests.cs | 54 +- .../Embedded Resources/Issue45.capnp.bin | Bin 0 -> 3360 bytes .../Embedded Resources/UnitTest1.capnp.bin | Bin 816 -> 816 bytes .../Embedded Resources/UnitTest10.capnp.bin | Bin 1600 -> 1616 bytes .../Embedded Resources/UnitTest10b.capnp.bin | Bin 0 -> 1040 bytes .../Embedded Resources/UnitTest11.capnp.bin | Bin 2408 -> 2080 bytes .../Embedded Resources/UnitTest11b.capnp.bin | Bin 0 -> 1184 bytes .../Embedded Resources/UnitTest12.capnp.bin | Bin 1392 -> 1504 bytes .../Embedded Resources/UnitTest13.capnp.bin | Bin 1320 -> 1256 bytes .../Embedded Resources/UnitTest14.capnp.bin | Bin 1888 -> 1824 bytes .../Embedded Resources/UnitTest15.capnp.bin | Bin 4728 -> 4240 bytes .../Embedded Resources/UnitTest2.capnp.bin | Bin 2608 -> 2608 bytes .../Embedded Resources/UnitTest20.capnp.bin | Bin 736 -> 736 bytes .../Embedded Resources/UnitTest3.capnp.bin | Bin 848 -> 848 bytes .../Embedded Resources/UnitTest4.capnp.bin | Bin 3600 -> 3304 bytes .../Embedded Resources/UnitTest4b.capnp.bin | Bin 0 -> 3736 bytes .../schema-csharp.capnp.bin | Bin 0 -> 42168 bytes .../No Resources/schema-csharp.capnp | 537 ++ CapnpC.CSharp.Generator/CapnpCompilation.cs | 2 +- .../CodeGen/CommonSnippetGen.cs | 2 +- CapnpC.CSharp.Generator/Model/SchemaModel.cs | 277 +- .../Model/SupportedAnnotations.cs | 36 +- .../Schema/SchemaSerialization.cs | 5782 ++++++++++++----- appveyor.yml | 8 +- 35 files changed, 5098 insertions(+), 1668 deletions(-) create mode 100644 Capnp.Net.Runtime/Rpc/NoResultsException.cs delete mode 100644 Capnp.Net.Runtime/Rpc/TailCallNoDataException.cs create mode 100644 CapnpC.CSharp.Generator.Tests/Embedded Resources/Issue45.capnp.bin create mode 100644 CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest10b.capnp.bin create mode 100644 CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest11b.capnp.bin create mode 100644 CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest4b.capnp.bin create mode 100644 CapnpC.CSharp.Generator.Tests/Embedded Resources/schema-csharp.capnp.bin create mode 100644 CapnpC.CSharp.Generator.Tests/No Resources/schema-csharp.capnp diff --git a/Capnp.Net.Runtime.Tests/ImpatientTests.cs b/Capnp.Net.Runtime.Tests/ImpatientTests.cs index 551c242..a009a43 100644 --- a/Capnp.Net.Runtime.Tests/ImpatientTests.cs +++ b/Capnp.Net.Runtime.Tests/ImpatientTests.cs @@ -162,10 +162,12 @@ namespace Capnp.Net.Runtime.Tests [TestMethod] public void ObsoleteGetAnswer() { +#pragma warning disable CS0618 var answer = new PromisedAnswerMock(); Assert.ThrowsException(() => Impatient.GetAnswer(answer.WhenReturned)); var t = Impatient.MakePipelineAware(answer, _ => _); Assert.AreEqual(answer, Impatient.GetAnswer(t)); +#pragma warning restore CS0618 } [TestMethod] @@ -182,8 +184,10 @@ namespace Capnp.Net.Runtime.Tests [TestMethod] public void ObsoletePseudoEager() { +#pragma warning disable CS0618 var task = Task.FromResult(new TestInterfaceImpl2()); Assert.IsTrue(task.PseudoEager() is Proxy proxy && proxy.WhenResolved.IsCompleted); +#pragma warning restore CS0618 } [TestMethod] diff --git a/Capnp.Net.Runtime.Tests/Mock/TestCapImplementations.cs b/Capnp.Net.Runtime.Tests/Mock/TestCapImplementations.cs index 3c5093e..7f1cac5 100644 --- a/Capnp.Net.Runtime.Tests/Mock/TestCapImplementations.cs +++ b/Capnp.Net.Runtime.Tests/Mock/TestCapImplementations.cs @@ -718,7 +718,7 @@ namespace Capnp.Net.Runtime.Tests.GenImpls await task2; Assert.Fail("Not a tail call"); } - catch (TailCallNoDataException) + catch (NoResultsException) { } } diff --git a/Capnp.Net.Runtime.Tests/SerializationTests.cs b/Capnp.Net.Runtime.Tests/SerializationTests.cs index ad40dc2..0e53fb1 100644 --- a/Capnp.Net.Runtime.Tests/SerializationTests.cs +++ b/Capnp.Net.Runtime.Tests/SerializationTests.cs @@ -1198,7 +1198,9 @@ namespace Capnp.Net.Runtime.Tests var p2 = (Proxy)Proxy.Share(impl); Assert.AreEqual(0u, dss.ProvideCapability(p1)); Assert.AreEqual(0u, dss.ProvideCapability(p2.ConsumedCap)); +#pragma warning disable CS0618 // Typ oder Element ist veraltet Assert.AreEqual(0u, dss.ProvideCapability(CapabilityReflection.CreateSkeleton(impl))); +#pragma warning restore CS0618 // Typ oder Element ist veraltet Assert.IsTrue(p1.IsDisposed); Assert.IsFalse(p2.IsDisposed); p2.Dispose(); diff --git a/Capnp.Net.Runtime.Tests/TcpRpc.cs b/Capnp.Net.Runtime.Tests/TcpRpc.cs index 0714581..0a99b2e 100644 --- a/Capnp.Net.Runtime.Tests/TcpRpc.cs +++ b/Capnp.Net.Runtime.Tests/TcpRpc.cs @@ -35,6 +35,7 @@ namespace Capnp.Net.Runtime.Tests ExpectingLogOutput = true; Logging.LoggerFactory?.Dispose(); +#pragma warning disable CS0618 // Typ oder Element ist veraltet Logging.LoggerFactory = new LoggerFactory().AddConsole((msg, level) => { if (!ExpectingLogOutput && level != LogLevel.Debug) @@ -43,6 +44,7 @@ namespace Capnp.Net.Runtime.Tests } return true; }); +#pragma warning restore CS0618 // Typ oder Element ist veraltet } int MediumNonDbgTimeout => Debugger.IsAttached ? Timeout.Infinite : 2000; diff --git a/Capnp.Net.Runtime.Tests/Util/TestBase.cs b/Capnp.Net.Runtime.Tests/Util/TestBase.cs index c44df31..2b08763 100644 --- a/Capnp.Net.Runtime.Tests/Util/TestBase.cs +++ b/Capnp.Net.Runtime.Tests/Util/TestBase.cs @@ -412,7 +412,9 @@ namespace Capnp.Net.Runtime.Tests public void InitConsoleLogging() { Logging.LoggerFactory?.Dispose(); +#pragma warning disable CS0618 // Typ oder Element ist veraltet Logging.LoggerFactory = new LoggerFactory().AddConsole((msg, level) => true); +#pragma warning restore CS0618 // Typ oder Element ist veraltet Logger = Logging.CreateLogger(); if (Thread.CurrentThread.Name == null) Thread.CurrentThread.Name = $"Test Thread {Thread.CurrentThread.ManagedThreadId}"; diff --git a/Capnp.Net.Runtime/CapnpSerializable.cs b/Capnp.Net.Runtime/CapnpSerializable.cs index ec7cb48..91a2d97 100644 --- a/Capnp.Net.Runtime/CapnpSerializable.cs +++ b/Capnp.Net.Runtime/CapnpSerializable.cs @@ -55,11 +55,22 @@ namespace Capnp } } + static object? CreateFromAny(DeserializerState state) + { + switch (state.Kind) + { + case ObjectKind.Capability: return state.RequireCap(); + case ObjectKind.Nil: return null; + default: return state; + } + } + static readonly ConditionalWeakTable> _typeMap = new ConditionalWeakTable>(); static CapnpSerializable() { + _typeMap.Add(typeof(object), CreateFromAny); _typeMap.Add(typeof(string), d => d.RequireList().CastText()); _typeMap.Add(typeof(IReadOnlyList), d => d.RequireList().CastBool()); _typeMap.Add(typeof(IReadOnlyList), d => d.RequireList().CastSByte()); diff --git a/Capnp.Net.Runtime/Rpc/Impatient.cs b/Capnp.Net.Runtime/Rpc/Impatient.cs index 1376a3c..c3a3804 100644 --- a/Capnp.Net.Runtime/Rpc/Impatient.cs +++ b/Capnp.Net.Runtime/Rpc/Impatient.cs @@ -29,7 +29,7 @@ namespace Capnp.Rpc { var result = await promise.WhenReturned; if (promise.IsTailCall) - throw new TailCallNoDataException(); + throw new NoResultsException(); return then(result); } diff --git a/Capnp.Net.Runtime/Rpc/NoResultsException.cs b/Capnp.Net.Runtime/Rpc/NoResultsException.cs new file mode 100644 index 0000000..5bb0269 --- /dev/null +++ b/Capnp.Net.Runtime/Rpc/NoResultsException.cs @@ -0,0 +1,16 @@ +namespace Capnp.Rpc +{ + /// + /// Thrown when a pending question did return, but was not configured to deliver the result back to the sender + /// (typcial for tail calls). + /// + public class NoResultsException: System.Exception + { + /// + /// Creates an instance + /// + public NoResultsException(): base("Pending question did return, but was not configured to deliver the result back to the sender") + { + } + } +} \ No newline at end of file diff --git a/Capnp.Net.Runtime/Rpc/TailCallNoDataException.cs b/Capnp.Net.Runtime/Rpc/TailCallNoDataException.cs deleted file mode 100644 index ef16c27..0000000 --- a/Capnp.Net.Runtime/Rpc/TailCallNoDataException.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Capnp.Rpc -{ - public class TailCallNoDataException: System.Exception - { - public TailCallNoDataException(): base("Because the question was asked as tail call, it won't return data") - { - } - } -} \ No newline at end of file diff --git a/CapnpC.CSharp.Generator.Tests/CodeGenerator.feature b/CapnpC.CSharp.Generator.Tests/CodeGenerator.feature index 7baa276..2da098b 100644 --- a/CapnpC.CSharp.Generator.Tests/CodeGenerator.feature +++ b/CapnpC.CSharp.Generator.Tests/CodeGenerator.feature @@ -71,4 +71,5 @@ Examples: | NullableDisable2.capnp.bin | false | true | success | | NullableEnable2.capnp.bin | false | false | errors | | NullableEnable2.capnp.bin | false | true | success | - | rpc-csharp.capnp.bin | true | true | warnings | \ No newline at end of file + | rpc-csharp.capnp.bin | true | true | warnings | + | schema-csharp.capnp.bin | false | false | success | \ No newline at end of file diff --git a/CapnpC.CSharp.Generator.Tests/CodeGenerator.feature.cs b/CapnpC.CSharp.Generator.Tests/CodeGenerator.feature.cs index 10e1f06..8070e3f 100644 --- a/CapnpC.CSharp.Generator.Tests/CodeGenerator.feature.cs +++ b/CapnpC.CSharp.Generator.Tests/CodeGenerator.feature.cs @@ -662,6 +662,21 @@ this.ValidGeneratorOutput("NullableEnable2.capnp.bin", "false", "true", "success { #line 50 this.ValidGeneratorOutput("rpc-csharp.capnp.bin", "true", "true", "warnings", ((string[])(null))); +#line hidden + } + + [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] + [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Valid generator output: Variant 16")] + [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "CodeGenerator")] + [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("VariantName", "Variant 16")] + [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("Parameter:bin", "schema-csharp.capnp.bin")] + [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("Parameter:nullablegen", "false")] + [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("Parameter:nullablesupp", "false")] + [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("Parameter:outcome", "success")] + public virtual void ValidGeneratorOutput_Variant16() + { +#line 50 +this.ValidGeneratorOutput("schema-csharp.capnp.bin", "false", "false", "success", ((string[])(null))); #line hidden } } diff --git a/CapnpC.CSharp.Generator.Tests/CodeGeneratorUnitTests.cs b/CapnpC.CSharp.Generator.Tests/CodeGeneratorUnitTests.cs index 4ccbd9b..9f71803 100644 --- a/CapnpC.CSharp.Generator.Tests/CodeGeneratorUnitTests.cs +++ b/CapnpC.CSharp.Generator.Tests/CodeGeneratorUnitTests.cs @@ -45,13 +45,13 @@ namespace CapnpC.CSharp.Generator.Tests [TestMethod] public void Test04MutualDependencies() { - LoadAndGenerate("UnitTest4.capnp.bin"); + LoadAndGenerate("UnitTest4.capnp.bin", "UnitTest4b.capnp.bin"); } [TestMethod] public void Test10ImportedNamespaces() { - var (model, codegen, _) = LoadAndGenerate("UnitTest10.capnp.bin"); + var (model, codegen, _) = LoadAndGenerate("UnitTest10.capnp.bin", "UnitTest10b.capnp.bin"); var outerTypeDef = GetGeneratedFile("UnitTest10.capnp", model).NestedTypes.First(); var outerType = Model.Types.FromDefinition(outerTypeDef); var innerType = outerTypeDef.Fields[0].Type; @@ -72,7 +72,7 @@ namespace CapnpC.CSharp.Generator.Tests [TestMethod] public void Test11ImportedConst() { - LoadAndGenerate("UnitTest11.capnp.bin"); + LoadAndGenerate("UnitTest11.capnp.bin", "UnitTest11b.capnp.bin"); } [TestMethod] @@ -147,20 +147,54 @@ namespace CapnpC.CSharp.Generator.Tests LoadAndGenerate("schema-with-offsets.capnp.bin"); } - static (Model.SchemaModel, CodeGen.CodeGenerator, string) LoadAndGenerate(string inputName) + [TestMethod] + public void Issue45() { - var model = Load(inputName); - var codegen = new CodeGen.CodeGenerator(model, new CodeGen.GeneratorOptions()); + var input = CodeGeneratorSteps.LoadResource("Issue45.capnp.bin"); + using (input) + { + var frame = Framing.ReadSegments(input); + var ds = DeserializerState.CreateRoot(frame); + var cgr = CapnpSerializable.Create(ds); + Assert.IsTrue(cgr.Nodes.Count > 0); + } + + } + + static (Model.SchemaModel, CodeGen.CodeGenerator, string) LoadAndGenerate(params string[] inputNames) + { + Model.SchemaModel firstModel = null; + CodeGen.CodeGenerator firstCodeGen = null; + + Model.SchemaModel LocalLoad(string name) + { + var model = Load(name); + firstModel = firstModel ?? model; + return model; + } + + CodeGen.CodeGenerator CreateCodeGen(Model.SchemaModel model) + { + var codegen = new CodeGen.CodeGenerator(model, new CodeGen.GeneratorOptions()); + firstCodeGen = firstCodeGen ?? codegen; + return codegen; + } + + var codes = ( + from name in inputNames + let model = LocalLoad(name) + let codegen = CreateCodeGen(model) + from file in model.FilesToGenerate + select codegen.Transform(file)).ToArray(); - var code = model.FilesToGenerate.Select(f => codegen.Transform(f)).ToArray(); Assert.AreEqual( Util.InlineAssemblyCompiler.CompileSummary.Success, Util.InlineAssemblyCompiler.TryCompileCapnp( Microsoft.CodeAnalysis.NullableContextOptions.Disable, - code), + codes), "Compilation was not successful with no warnings"); - return (model, codegen, code[0]); + return (firstModel, firstCodeGen, codes[0]); } static Model.GenFile GetGeneratedFile(string name, Model.SchemaModel model) @@ -199,7 +233,7 @@ namespace CapnpC.CSharp.Generator.Tests segments = Framing.ReadSegments(input); } var dec = DeserializerState.CreateRoot(segments); - var reader = CodeGeneratorRequest.Reader.Create(dec); + var reader = CodeGeneratorRequest.READER.create(dec); var model = Model.SchemaModel.Create(reader); return model; } diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/Issue45.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/Issue45.capnp.bin new file mode 100644 index 0000000000000000000000000000000000000000..7bc8073c6f9ae632e3a84ff23c0ec7151f1c6fbb GIT binary patch literal 3360 zcmbVOU1%It6h50Yv5FOK)oNdw21F_*HQGKH5K`0BM%pGRO0f^p+0CRG-JRLY?CR!0 z!Jh}Iwn!Cx5Cp450&1m7E9gT7MQEtdO4UNEh)5nJ0euk#!S9ZY+Xl~a=lq|0 z=ltAR5s`Nac*M{ttAM}m5ZTo&vObX-b$5(WDBWTlR6ZB+Eboce0^n8(w^9eGlo$00pHo)Bqx1ub+m2W zb8B+aJbMS?oq=!w_*7omhS&GL0XpVE&(Az$;cdh_0l^$_R&xye@vLD&zw+(DUa$A2 z_iqQ^B{e+F`SYe5J4OD0a0_rY?mgf;TPk5ZXVzaBJGypZj&TdHNaJR`MK(Y+h#C## z;`V`WcixGGqw_CEU(TC6bTsqOdMc5x;C~*wp3B8OYl-{gk>RCZzN?%zdFaWU7i0#` ztq}Pe{AJ+moBRO2T^^!Z=tj{%f61x()xnX5Q>m8Se%IiK!k}I?!EXfW6a;AktDJ%Z zvY4{6A2jzX19t$^*4P)or{IAcOj(%(O+Ri+KiV35QzbR6fVfK;;At%Su|w#GG{%d& zW=}l>`GZ&rJRkiU!1S9A>XEy8YJoS1n+z&d$ z+Vk{=xs{tgKTDqb-}219-!A@i{Ld|*AI2(rwFpQ&zwG(0h!chm3s-v7$4iP#c@1}R zrx&p=2{8}6o$~R(^Ap8XIdDjBC-(dUstTs2BKFaay<-W*C?YNO(YZCMIFIa${JbXW z7%^Yj`56MwIoJuT^9m9Y1Nxm~-k(Th?GR_x%v%BXbqdTE^R2KM1os;P=6+T54RyR{ z2-;_cOP{JwC5Fo1SW&&Gtrr`ppZ06sU-fypt#1dl@Ni(?vj49H);RfsBM9Ryr+(~5 zg&`36`ssbEHKZ-;*GnRSZNT&!2WA~uKQ5la;FuB4U$$R%fT!Oh!1Rl}1HOyPJG+kal|1$AGio$1x5fN_AGYtDTH5r* z#9+Dm->d<1*cM;SZ2D4ef4%SZ{muIpn)i;zBj$eyTfeH^bxK&UO>eyq^g|Huot{g- mOZjayuj&77^W9=S*J8EwHF#ssw=(~uNu9^qWIGUagnt2m|8Q#n literal 0 HcmV?d00001 diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest1.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest1.capnp.bin index ae47486724106d3236d29bd30325fcb8e2286f47..c417bd7a0abedfa7896ec48973b40752926718f1 100644 GIT binary patch delta 39 ocmdnMwt;QK1SWBnHM0YjX5XI700ojjnxBDTazB&iQPk#X$-tD>BMYoS-4e2{hsoP(Tz&L-YeVKp-&jqWEM7 zMh!tmphOc;fE7rq18GH&PR^YzJr4v6ASVRfD#N0lh3jgPyWH=G5H4bipd&mf|KX5a7!@)!v$Tnm49hT zYSH98rY@i|iOC7f6_TKUVq{=qfY}W;5Nzl{Ci%%97&#_3NPv8d0$|>P3GxCN{0s~e n=S#YRA_Nj8UjQ--O7sw42x4N~D2SvlLJn#OM2O}hh>Yt9dq~f+GdXAwRB}=; z5k&MLcoHvqHHwB@j3*KO1OA2V$p;a?uV-pzc6MjQf|`1Cb#>KO-J_IJtKf*rY8#Y+ zl2VJ{Q?b{vvSP(<=zXf9CVy96E_}Q6b}wu$?D+Cz^3}QZcaGXrGUVirT<5E9-eaL)gYV^(gtsn0*AyyqkzOT@Z&DoOyeA~VE3(qB ztf!txvvpN#!^3ff#+~(ohFkM8fvj_D#_pyT^nEo-t89nNBlWRM_B9dLPaGU{B=?>+ z`-|q&c|P~w1E2AItsnth5OB3ou0KWmScjam8TK^z^Wxf{8!xW4Xb*w&IM9YW z?&JUJe2RV1{IzS0AG%@PHvzMy)Ehr7Fxd^PzaU=VPVkohli)2kun2G7Dc0h d1Q(gVMzz_{I382 diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest10b.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest10b.capnp.bin new file mode 100644 index 0000000000000000000000000000000000000000..a94097595fd717dc9a4def1102d62047005510ac GIT binary patch literal 1040 zcmbVLJ4*vW5T1*PFBGDUc9wz>6D{`#C^i;8YB}Q>Qn(kAYa|FpY}7OcM6?i6S&3K( z27C~~N27&cDfkz((nkE|)+Luq&ccCjXXmlA-_7h15fuO>Vd}vqWf0v01K5WFY-tlq z3Yw_RU87hd)Jl6-#`b-6_oU191~2;vm4GtP2OI-jKS+k>*RBu0?kegYg9=lL^Ze@P zr9b}+j%T0>C}t|-0;#IZU@bWp$ zw*&Sx@U-*(y>hhp!S)c~zmILW|Mk5GIOp;Z!j#f>Oeby299OGJL;r>Du;R<_(?DnS y9BL=kuJ#VbX`5?xPJgDoqhm6rk_Uu literal 0 HcmV?d00001 diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest11.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest11.capnp.bin index 1d702abb501b8d84ceee9d791605ae3d1828508f..85d58d009d84f1d864e0a2bf834626a3dcbdd27d 100644 GIT binary patch delta 639 zcmZuv%_~Gv6uBOMsmzalNnz~X!<^vdNa1Tk=)rjnSYM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1(SK1lF{@PFv(Az!sIh~0jr24$PObiV2KsE~y1Gx-OCu+(wa!+n#loy=|H@_d0p%@$G&{)7i3u!%p?R4lA*sbBhQ@lyi3NED43mE{p0Aey zDq{q~rEiaAh&A)RHU#pkfOr8CKM2TQh{OlUFGk{T0`iwY`KCbjFCbn9<=X<;AoYuo z_*y`INM%84SY|PMW>RKOW=ZAbe@selskxaYex*4%iAg!BE}2EC$t9U(sX(f`loy=|q~=;LgOG_M&HjyeuHT2*l<<{1=G9 zx;al4tBYJJ+Swm9IgnAFmlbHM7Bd5bDUfCd**h_T#na77KPa^zzgRyxu^_LYD8D3M zHzmI$FSR5&zbIAT86@be=Nz1oSX7|ro|>0hlvt8qq!*G}TvDv>m#+|%TAW{6l$=_u zKY0P8_~adoC(L+&)-wX(g15&q#F}|ugZv)^#0!!5RY3kCB)%5IWHx4{$py>_RCLe< ZX64CWm{){?Le>yyAt+?2>)it^8UW6Fj8Xsq diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest14.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest14.capnp.bin index 0e48988e8e4fb84759ae11ff85d4fe81826a3418..ade11571b9cecdbb57433cd64f10a9167aa9b41a 100644 GIT binary patch delta 515 zcmaFBw}4NR0SF$02ryt_5CqcVObiUR%nS_jKsE~yGXn9|iJJ0^+>;HN(4wR9eI735H7s%NK6f_0W>_8d@3?|;R7gYobW&uT1fpj^Lo(rVqK{_WZ zuyITdU{sJ?3KY2nl-UTRk+rXx+{tJ!3R2$$lwAm<)q(V0APv#~ft7<%a55v4JnvDU z*dw6aMIg-%a___h7QxWG%#x7Q;u1p>z2wA#yaI;JE1CEi>t%rI7=du<+hZAG&AhJ- zf&3~UUVy|80`eCk@j>#7k@%Z{{3TGnDUkgOh?hb6wm>#W{URj37LXrOS&$l*SIQ#NoH9pP%TK@B|kSYGtW6EvA8(3*fB4~ yGp{7IC@nELwU~jS1Y#D{sLgyVL5!1EvMNtL&3aQ76id873<@iZAehX_9u5F;?t3Qy delta 561 zcmZ3$_kd560SI1$2ryt_5CqcVObiT`%nS_jKsE~yGXn9&iJJ0^A(IW6W+tu2!~8SO{9^s&#DctnqWqG4-IV;2ywsB9{GwESXON(? zo^x4QDRAckzPn@aY?bhU%o<6YH@yPQF3ar{^S5A@y!`b9E@f>KsPV~ z;exlvGQ^sBUxNZK2#6OV@vDIRMM!)thRNTUl{P1^1Ta$3NgG&|CtqQ`5ekYIL!gbI N(4ne_CtqL-002k0kCp%c diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest15.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest15.capnp.bin index 2cd9b987ecc036a88629ccbaa34d55a0758fc329..267ea05d21412dcf1be32e5eed2663af6dc6f769 100644 GIT binary patch delta 849 zcmZuwO=uHA6rR~l(r)vkQELn~Y#J>!D%ur2h)5NKC5SBv)}ptxZgtBxwcWI(y?78j z^yKDw@s>s_cu{NgP{D&2ZzUq=JwgSM3Q~|-LHu5AAxdYN{pS1Ld*9BR-Cf;(w>2p+ z!V2GcctjZYsw#xmD1^SQ2qA%OZc>+il8UY^g3mzu;Eo=ZVRu%K)u4QWvJ7n4KrUwE zr*39fJO7A5@ zMyMnY#OIMwgxLa+x3D>0fUD?$-fiDgRN~<|@F4^r11Ev4WGG$Hq(_KXUr)`aeZ6^WBroV&!y0INrB6%CTP<*rxaOAM-q?LR_|*WP#w^wGEck34=lFv<{v7<_ z20wu{@A%OMKaDl#m+SaJ@JmxS&C8b4VD($JRhXiWO^Ng7uvO?Dx9wcNZKkX-bD&^N zn8;;4H8PyD^5^WFYk8dyZ1&2%J~z?!ctum2qi!8L|cZK`49r+Pt-d literal 4728 zcmc&&O=w(I6uy&W`XdG_w*F+}fCX)^GY%NUppW5uQJ&N`aumt>br&51`Duo8%Nnly+P!D{6>DZ?) z-oAD`mKOhf2P4avXBG6B;$gj>Z-dA8F8fzMH~~pX4ff`d`DI`kHb=4EF;K3Il6x4L-TT(Jlc6v6RnCE@4SEbYq=r69^0Xhk~dq>*u zN5^Y3y6XkCrqgx1z8882=e^L?Vbk+ z$=9mo6qNNOzwX>IvF_&#w{`$H!bSr7L787qftvjKr>7@5!=VR(w%!xqsrNJ}^&%Po z6vfT-7WYSWGh(Cq+i@?%eon&M_cQ%K;A^7~>-$-JQA+u2JwGpQ($9;V^m8+aOGJG2 zkGoEXcd`I8EqfnIpHN$$GN~K#u3%l@ee_ZC&LDplDEBY*blb0E{bQ^|0%Dp%db|2{_yWdmphMti{}oAGS7M?F!0W znjFikV|(H~{Wos(!#J=Jq-}{m#T8{VeBf>%>j$qQYTyCkvS!J6iJ$m?t@=3!Ju|OZ zfgpjc^;_?y5g+xJb=dOe_rK!!PDkSZKg^G}SJV!Z1<-$My&w1;!MKq!9=tAiPd^9B zy!T^c8;gs1*O=wNTnbFBNr_TSQU5miGhWMD=V1MO?BzykUnU+r1qS4ML%t7qU!4H% z1LnQ2>X7sO&U0h(4Gdr-=f=dxwqk7ce@ztV2i9-i2Sp(7bm@1{xDP1rd6Az?Pt|5Y^TfBKa>7s&FB$0{A&nbUrS z6{fP_`IV+OuPck@n+TO)_#W!A{@Zq97C%LD*zJ|9VymVe=Ghhdk{99+W*-0V!aSm1 Xx9mJ63o!Hdzx(M)-v2ebAcFrFYTEZb diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest2.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest2.capnp.bin index 5a2eafcc0b95779d73149763083f37b1cf4e79de..e980262b36c2986572e8fca13d2520e69e9f9480 100644 GIT binary patch delta 87 zcmdlWvO#1+0H^59NBQ$5WVXIwfC57x%|2O?QCd)!L%6AH-tqS^8QIB+ociLTAbFS& S10w?un9T^(AwT&WrxgHf4iGE= delta 67 zcmdlWvO#1+0H>fXhj3HZyyNc~pulkQL{5E4O(2gQh;Kg1pD!V^^#x2;adIN3{NxLq K8k0Y8IsgDqjuBV@ diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest20.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest20.capnp.bin index 48f5e96c07e29ed4b7740691d998d795288f8924..92195afae6730c889638b0d71f95df816545ff23 100644 GIT binary patch delta 40 mcmaFB`hayq1e0jJl%w@Cj|CSPkio>i(vu6ABqlFlasUAF^a|Jj delta 18 acmaFB`hayq1k>aKCWDC|I3`bE3IG5`^alt4 diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest3.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest3.capnp.bin index c0a1dae51d34da223a748dbfd981e4e9e939341d..010bfe1e9eec5b9e5ceb81355b726b3017af1a09 100644 GIT binary patch delta 27 jcmcb>c7bif3MP(iz1mCb`$e};-oT_W@dL-?2TTP3rLqgx delta 33 pcmcb>c7bif3MP(5KZ70BwLkVw-oT{6v8`8oX??%w_Q?;J3IO+B4!QsU diff --git a/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest4.capnp.bin b/CapnpC.CSharp.Generator.Tests/Embedded Resources/UnitTest4.capnp.bin index edcead06ed05aaaaf80654caff95a2119c09bd73..710cca62c17a2dd3999472f3a385d08fe3e475c6 100644 GIT binary patch delta 944 zcmZuwO=uHA6rN3XH@j&1PcvR@SEw5l*I=#Z@%w+^JaMSW~T8+ zvWvm)DtzXqG7EFX&)80#F7in$bFOy8qa6l5 zh8)u#e&Is@x!YT=RHIb#H`OCJ579-BXhIxxxX|`uWuUDbBgJp)%g}sfw8OVeIpSot zn#bp_eP1apev45~wYUFqGifMz0vV-Qz+CRk7>ecGvC}CKj}T46^TJB&1Ln1qUh*F& zXCK^b?zvpYUnK+4bws-0`6<2d;#H=?QCd)ols7wRO`D^saD>!QlFETbss`2t&IZEN zA2?0rAh_TDb^h!gE~WVVm+-HG^?G8_l}N?pBNq+KRCF5D3>42i(Anf zee4kL8U+t7>nS3bCNTKbWbroh5$9e5J@?h0X+3%A?fu&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generator.Tests/No Resources/schema-csharp.capnp b/CapnpC.CSharp.Generator.Tests/No Resources/schema-csharp.capnp new file mode 100644 index 0000000..05a6edc --- /dev/null +++ b/CapnpC.CSharp.Generator.Tests/No Resources/schema-csharp.capnp @@ -0,0 +1,537 @@ +# Copyright (c) 2020 Christian Köllner and contributors +# This is a modified version of schema.capnp, found in the original distribution +# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +# Licensed under the MIT License: +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +@0xa93fc509624c72d9; +# $$embed +# #pragma warning disable CS1591 + +using CSharp = import "/csharp.capnp"; +$CSharp.namespace("CapnpC.CSharp.Generator.Schema"); +$CSharp.nullableEnable(false); +$CSharp.emitNullableDirective(false); +$CSharp.emitDomainClassesAndInterfaces(true); +$CSharp.typeVisibility(public); + +using Id = UInt64; +# The globally-unique ID of a file, type, or annotation. + +struct Node { + id @0 :Id; + + displayName @1 :Text; + # Name to present to humans to identify this Node. You should not attempt to parse this. Its + # format could change. It is not guaranteed to be unique. + # + # (On Zooko's triangle, this is the node's nickname.) + + displayNamePrefixLength @2 :UInt32; + # If you want a shorter version of `displayName` (just naming this node, without its surrounding + # scope), chop off this many characters from the beginning of `displayName`. + + scopeId @3 :Id; + # ID of the lexical parent node. Typically, the scope node will have a NestedNode pointing back + # at this node, but robust code should avoid relying on this (and, in fact, group nodes are not + # listed in the outer struct's nestedNodes, since they are listed in the fields). `scopeId` is + # zero if the node has no parent, which is normally only the case with files, but should be + # allowed for any kind of node (in order to make runtime type generation easier). + + parameters @32 :List(Parameter); + # If this node is parameterized (generic), the list of parameters. Empty for non-generic types. + + isGeneric @33 :Bool; + # True if this node is generic, meaning that it or one of its parent scopes has a non-empty + # `parameters`. + + struct Parameter { + # Information about one of the node's parameters. + + name @0 :Text; + } + + nestedNodes @4 :List(NestedNode); + # List of nodes nested within this node, along with the names under which they were declared. + + struct NestedNode { + name @0 :Text; + # Unqualified symbol name. Unlike Node.displayName, this *can* be used programmatically. + # + # (On Zooko's triangle, this is the node's petname according to its parent scope.) + + id @1 :Id; + # ID of the nested node. Typically, the target node's scopeId points back to this node, but + # robust code should avoid relying on this. + } + + annotations @5 :List(Annotation); + # Annotations applied to this node. + + union { + # Info specific to each kind of node. + + file @6 :Void; + + struct :group { + dataWordCount @7 :UInt16; + # Size of the data section, in words. + + pointerCount @8 :UInt16; + # Size of the pointer section, in pointers (which are one word each). + + preferredListEncoding @9 :ElementSize; + # The preferred element size to use when encoding a list of this struct. If this is anything + # other than `inlineComposite` then the struct is one word or less in size and is a candidate + # for list packing optimization. + + isGroup @10 :Bool; + # If true, then this "struct" node is actually not an independent node, but merely represents + # some named union or group within a particular parent struct. This node's scopeId refers + # to the parent struct, which may itself be a union/group in yet another struct. + # + # All group nodes share the same dataWordCount and pointerCount as the top-level + # struct, and their fields live in the same ordinal and offset spaces as all other fields in + # the struct. + # + # Note that a named union is considered a special kind of group -- in fact, a named union + # is exactly equivalent to a group that contains nothing but an unnamed union. + + discriminantCount @11 :UInt16; + # Number of fields in this struct which are members of an anonymous union, and thus may + # overlap. If this is non-zero, then a 16-bit discriminant is present indicating which + # of the overlapping fields is active. This can never be 1 -- if it is non-zero, it must be + # two or more. + # + # Note that the fields of an unnamed union are considered fields of the scope containing the + # union -- an unnamed union is not its own group. So, a top-level struct may contain a + # non-zero discriminant count. Named unions, on the other hand, are equivalent to groups + # containing unnamed unions. So, a named union has its own independent schema node, with + # `isGroup` = true. + + discriminantOffset @12 :UInt32; + # If `discriminantCount` is non-zero, this is the offset of the union discriminant, in + # multiples of 16 bits. + + fields @13 :List(Field); + # Fields defined within this scope (either the struct's top-level fields, or the fields of + # a particular group; see `isGroup`). + # + # The fields are sorted by ordinal number, but note that because groups share the same + # ordinal space, the field's index in this list is not necessarily exactly its ordinal. + # On the other hand, the field's position in this list does remain the same even as the + # protocol evolves, since it is not possible to insert or remove an earlier ordinal. + # Therefore, for most use cases, if you want to identify a field by number, it may make the + # most sense to use the field's index in this list rather than its ordinal. + } + + enum :group { + enumerants@14 :List(Enumerant); + # Enumerants ordered by numeric value (ordinal). + } + + interface :group { + methods @15 :List(Method); + # Methods ordered by ordinal. + + superclasses @31 :List(Superclass); + # Superclasses of this interface. + } + + const :group { + type @16 :Type; + value @17 :Value; + } + + annotation :group { + type @18 :Type; + + targetsFile @19 :Bool; + targetsConst @20 :Bool; + targetsEnum @21 :Bool; + targetsEnumerant @22 :Bool; + targetsStruct @23 :Bool; + targetsField @24 :Bool; + targetsUnion @25 :Bool; + targetsGroup @26 :Bool; + targetsInterface @27 :Bool; + targetsMethod @28 :Bool; + targetsParam @29 :Bool; + targetsAnnotation @30 :Bool; + } + } + + struct SourceInfo { + # Additional information about a node which is not needed at runtime, but may be useful for + # documentation or debugging purposes. This is kept in a separate struct to make sure it + # doesn't accidentally get included in contexts where it is not needed. The + # `CodeGeneratorRequest` includes this information in a separate array. + + id @0 :Id; + # ID of the Node which this info describes. + + docComment @1 :Text; + # The top-level doc comment for the Node. + + members @2 :List(Member); + # Information about each member -- i.e. fields (for structs), enumerants (for enums), or + # methods (for interfaces). + # + # This list is the same length and order as the corresponding list in the Node, i.e. + # Node.struct.fields, Node.enum.enumerants, or Node.interface.methods. + + struct Member { + docComment @0 :Text; + # Doc comment on the member. + } + + # TODO(someday): Record location of the declaration in the original source code. + } +} + +struct Field { + # Schema for a field of a struct. + + name @0 :Text; + + codeOrder @1 :UInt16; + # Indicates where this member appeared in the code, relative to other members. + # Code ordering may have semantic relevance -- programmers tend to place related fields + # together. So, using code ordering makes sense in human-readable formats where ordering is + # otherwise irrelevant, like JSON. The values of codeOrder are tightly-packed, so the maximum + # value is count(members) - 1. Fields that are members of a union are only ordered relative to + # the other members of that union, so the maximum value there is count(union.members). + + annotations @2 :List(Annotation); + + const noDiscriminant :UInt16 = 0xffff; + + discriminantValue @3 :UInt16 = Field.noDiscriminant; + # If the field is in a union, this is the value which the union's discriminant should take when + # the field is active. If the field is not in a union, this is 0xffff. + + union { + slot :group { + # A regular, non-group, non-fixed-list field. + + offset @4 :UInt32; + # Offset, in units of the field's size, from the beginning of the section in which the field + # resides. E.g. for a UInt32 field, multiply this by 4 to get the byte offset from the + # beginning of the data section. + + type @5 :Type; + defaultValue @6 :Value; + + hadExplicitDefault @10 :Bool; + # Whether the default value was specified explicitly. Non-explicit default values are always + # zero or empty values. Usually, whether the default value was explicit shouldn't matter. + # The main use case for this flag is for structs representing method parameters: + # explicitly-defaulted parameters may be allowed to be omitted when calling the method. + } + + group :group { + # A group. + + typeId @7 :Id; + # The ID of the group's node. + } + } + + ordinal :union { + implicit @8 :Void; + explicit @9 :UInt16; + # The original ordinal number given to the field. You probably should NOT use this; if you need + # a numeric identifier for a field, use its position within the field array for its scope. + # The ordinal is given here mainly just so that the original schema text can be reproduced given + # the compiled version -- i.e. so that `capnp compile -ocapnp` can do its job. + } +} + +struct Enumerant { + # Schema for member of an enum. + + name @0 :Text; + + codeOrder @1 :UInt16; + # Specifies order in which the enumerants were declared in the code. + # Like Struct.Field.codeOrder. + + annotations @2 :List(Annotation); +} + +struct Superclass { + id @0 :Id; + brand @1 :Brand; +} + +struct Method { + # Schema for method of an interface. + + name @0 :Text; + + codeOrder @1 :UInt16; + # Specifies order in which the methods were declared in the code. + # Like Struct.Field.codeOrder. + + implicitParameters @7 :List(Node.Parameter); + # The parameters listed in [] (typically, type / generic parameters), whose bindings are intended + # to be inferred rather than specified explicitly, although not all languages support this. + + paramStructType @2 :Id; + # ID of the parameter struct type. If a named parameter list was specified in the method + # declaration (rather than a single struct parameter type) then a corresponding struct type is + # auto-generated. Such an auto-generated type will not be listed in the interface's + # `nestedNodes` and its `scopeId` will be zero -- it is completely detached from the namespace. + # (Awkwardly, it does of course inherit generic parameters from the method's scope, which makes + # this a situation where you can't just climb the scope chain to find where a particular + # generic parameter was introduced. Making the `scopeId` zero was a mistake.) + + paramBrand @5 :Brand; + # Brand of param struct type. + + resultStructType @3 :Id; + # ID of the return struct type; similar to `paramStructType`. + + resultBrand @6 :Brand; + # Brand of result struct type. + + annotations @4 :List(Annotation); +} + +struct Type { + # Represents a type expression. + + union { + # The ordinals intentionally match those of Value. + + void @0 :Void; + bool @1 :Void; + int8 @2 :Void; + int16 @3 :Void; + int32 @4 :Void; + int64 @5 :Void; + uint8 @6 :Void; + uint16 @7 :Void; + uint32 @8 :Void; + uint64 @9 :Void; + float32 @10 :Void; + float64 @11 :Void; + text @12 :Void; + data @13 :Void; + + list :group { + elementType @14 :Type; + } + + enum :group { + typeId @15 :Id; + brand @21 :Brand; + } + struct :group { + typeId @16 :Id; + brand @22 :Brand; + } + interface :group { + typeId @17 :Id; + brand @23 :Brand; + } + + anyPointer :union { + unconstrained :union { + # A regular AnyPointer. + # + # The name "unconstrained" means as opposed to constraining it to match a type parameter. + # In retrospect this name is probably a poor choice given that it may still be constrained + # to be a struct, list, or capability. + + anyKind @18 :Void; # truly AnyPointer + struct @25 :Void; # AnyStruct + list @26 :Void; # AnyList + capability @27 :Void; # Capability + } + + parameter :group { + # This is actually a reference to a type parameter defined within this scope. + + scopeId @19 :Id; + # ID of the generic type whose parameter we're referencing. This should be a parent of the + # current scope. + + parameterIndex @20 :UInt16; + # Index of the parameter within the generic type's parameter list. + } + + implicitMethodParameter :group { + # This is actually a reference to an implicit (generic) parameter of a method. The only + # legal context for this type to appear is inside Method.paramBrand or Method.resultBrand. + + parameterIndex @24 :UInt16; + } + } + } +} + +struct Brand { + # Specifies bindings for parameters of generics. Since these bindings turn a generic into a + # non-generic, we call it the "brand". + + scopes @0 :List(Scope); + # For each of the target type and each of its parent scopes, a parameterization may be included + # in this list. If no parameterization is included for a particular relevant scope, then either + # that scope has no parameters or all parameters should be considered to be `AnyPointer`. + + struct Scope { + scopeId @0 :Id; + # ID of the scope to which these params apply. + + union { + bind @1 :List(Binding); + # List of parameter bindings. + + inherit @2 :Void; + # The place where this Brand appears is actually within this scope or a sub-scope, + # and the bindings for this scope should be inherited from the reference point. + } + } + + struct Binding { + union { + unbound @0 :Void; + type @1 :Type; + + # TODO(someday): Allow non-type parameters? Unsure if useful. + } + } +} + +struct Value { + # Represents a value, e.g. a field default value, constant value, or annotation value. + + union { + # The ordinals intentionally match those of Type. + + void @0 :Void; + bool @1 :Bool; + int8 @2 :Int8; + int16 @3 :Int16; + int32 @4 :Int32; + int64 @5 :Int64; + uint8 @6 :UInt8; + uint16 @7 :UInt16; + uint32 @8 :UInt32; + uint64 @9 :UInt64; + float32 @10 :Float32; + float64 @11 :Float64; + text @12 :Text; + data @13 :Data; + + list @14 :AnyPointer; + + enum @15 :UInt16; + struct @16 :AnyPointer; + + interface @17 :Void; + # The only interface value that can be represented statically is "null", whose methods always + # throw exceptions. + + anyPointer @18 :AnyPointer; + } +} + +struct Annotation { + # Describes an annotation applied to a declaration. Note AnnotationNode describes the + # annotation's declaration, while this describes a use of the annotation. + + id @0 :Id; + # ID of the annotation node. + + brand @2 :Brand; + # Brand of the annotation. + # + # Note that the annotation itself is not allowed to be parameterized, but its scope might be. + + value @1 :Value; +} + +enum ElementSize { + # Possible element sizes for encoded lists. These correspond exactly to the possible values of + # the 3-bit element size component of a list pointer. + + empty @0; # aka "void", but that's a keyword. + bit @1; + byte @2; + twoBytes @3; + fourBytes @4; + eightBytes @5; + pointer @6; + inlineComposite @7; +} + +struct CapnpVersion { + major @0 :UInt16; + minor @1 :UInt8; + micro @2 :UInt8; +} + +struct CodeGeneratorRequest { + capnpVersion @2 :CapnpVersion; + # Version of the `capnp` executable. Generally, code generators should ignore this, but the code + # generators that ship with `capnp` itself will print a warning if this mismatches since that + # probably indicates something is misconfigured. + # + # The first version of 'capnp' to set this was 0.6.0. So, if it's missing, the compiler version + # is older than that. + + nodes @0 :List(Node); + # All nodes parsed by the compiler, including for the files on the command line and their + # imports. + + sourceInfo @3 :List(Node.SourceInfo); + # Information about the original source code for each node, where available. This array may be + # omitted or may be missing some nodes if no info is available for them. + + requestedFiles @1 :List(RequestedFile); + # Files which were listed on the command line. + + struct RequestedFile { + id @0 :Id; + # ID of the file. + + filename @1 :Text; + # Name of the file as it appeared on the command-line (minus the src-prefix). You may use + # this to decide where to write the output. + + imports @2 :List(Import); + # List of all imported paths seen in this file. + + struct Import { + id @0 :Id; + # ID of the imported file. + + name @1 :Text; + # Name which *this* file used to refer to the foreign file. This may be a relative name. + # This information is provided because it might be useful for code generation, e.g. to + # generate #include directives in C++. We don't put this in Node.file because this + # information is only meaningful at compile time anyway. + # + # (On Zooko's triangle, this is the import's petname according to the importing file.) + } + } +} diff --git a/CapnpC.CSharp.Generator/CapnpCompilation.cs b/CapnpC.CSharp.Generator/CapnpCompilation.cs index 2bbf913..bfef9c5 100644 --- a/CapnpC.CSharp.Generator/CapnpCompilation.cs +++ b/CapnpC.CSharp.Generator/CapnpCompilation.cs @@ -40,7 +40,7 @@ namespace CapnpC.CSharp.Generator { var segments = Framing.ReadSegments(input); var dec = DeserializerState.CreateRoot(segments); - var reader = Schema.CodeGeneratorRequest.Reader.Create(dec); + var reader = Schema.CodeGeneratorRequest.READER.create(dec); var model = Model.SchemaModel.Create(reader); var codeGen = new CodeGen.CodeGenerator(model, options ?? new CodeGen.GeneratorOptions()); return new GenerationResult(codeGen.Generate()); diff --git a/CapnpC.CSharp.Generator/CodeGen/CommonSnippetGen.cs b/CapnpC.CSharp.Generator/CodeGen/CommonSnippetGen.cs index 2c6a172..64c1f48 100644 --- a/CapnpC.CSharp.Generator/CodeGen/CommonSnippetGen.cs +++ b/CapnpC.CSharp.Generator/CodeGen/CommonSnippetGen.cs @@ -40,7 +40,7 @@ namespace CapnpC.CSharp.Generator.CodeGen EqualsValueClause( LiteralExpression( SyntaxKind.NumericLiteralExpression, - Literal(Schema.Field.Reader.NoDiscriminant)))); + Literal(SchemaModel.NoDiscriminant)))); whichEnum = whichEnum.AddMembers(ndecl); diff --git a/CapnpC.CSharp.Generator/Model/SchemaModel.cs b/CapnpC.CSharp.Generator/Model/SchemaModel.cs index 2b75e7c..3262f8f 100644 --- a/CapnpC.CSharp.Generator/Model/SchemaModel.cs +++ b/CapnpC.CSharp.Generator/Model/SchemaModel.cs @@ -8,21 +8,23 @@ namespace CapnpC.CSharp.Generator.Model { class SchemaModel { - readonly Schema.CodeGeneratorRequest.Reader _request; + public const ushort NoDiscriminant = 65535; + + readonly Schema.CodeGeneratorRequest.READER _request; readonly List _generatedFiles = new List(); readonly DefinitionManager _typeDefMgr = new DefinitionManager(); - readonly Dictionary _id2node = new Dictionary(); + readonly Dictionary _id2node = new Dictionary(); readonly Dictionary _id2sourceInfo = new Dictionary(); - public SchemaModel(Schema.CodeGeneratorRequest.Reader request) + public SchemaModel(Schema.CodeGeneratorRequest.READER request) { _request = request; } public IReadOnlyList FilesToGenerate => _generatedFiles; - Schema.Node.Reader? IdToNode(ulong id, bool mustExist) + Schema.Node.READER? IdToNode(ulong id, bool mustExist) { if (_id2node.TryGetValue(id, out var node)) return node; @@ -31,9 +33,9 @@ namespace CapnpC.CSharp.Generator.Model return null; } - Schema.Node.Reader IdToNode(ulong id) + Schema.Node.READER IdToNode(ulong id) { - return (Schema.Node.Reader)IdToNode(id, true); + return (Schema.Node.READER)IdToNode(id, true); } void Build() @@ -76,13 +78,13 @@ namespace CapnpC.CSharp.Generator.Model public IHasNestedDefinitions parent; } - void BuildPass1(Dictionary requestedFiles) + void BuildPass1(Dictionary requestedFiles) { Pass1State state = new Pass1State() { unprocessedNodes = new HashSet(_id2node.Keys) }; - foreach (var node in _id2node.Values.Where(n => n.IsFile)) + foreach (var node in _id2node.Values.Where(n => n.which == Schema.Node.WHICH.File)) { GenFile file; bool isGenerated = requestedFiles.TryGetValue(node.Id, out var req); @@ -118,7 +120,7 @@ namespace CapnpC.CSharp.Generator.Model IDefinition ProcessNodePass1(ulong id, string name, Pass1State state) { bool mustExist = state.parent == null || (state.parent as IDefinition).IsGenerated; - if (!(IdToNode(id, mustExist) is Schema.Node.Reader node)) + if (!(IdToNode(id, mustExist) is Schema.Node.READER node)) return null; if (!state.unprocessedNodes.Remove(id)) return null; @@ -175,18 +177,18 @@ namespace CapnpC.CSharp.Generator.Model { ProcessNodePass1(nested.Id, nested.Name, state); } - if (processFields && node.Fields != null) - foreach (var field in node.Fields.Where(f => f.IsGroup)) + if (processFields && node.Struct.Fields != null) + foreach (var field in node.Struct.Fields.Where(f => f.which == Schema.Field.WHICH.Group)) { - var group = IdToNode(field.Group_TypeId); - if (!group.IsStruct || !group.Struct_IsGroup) + var group = IdToNode(field.Group.TypeId); + if (group.which != Schema.Node.WHICH.Struct || !group.Struct.IsGroup) { throw new InvalidSchemaException($"Expected node with id {group.StrId()} to be a struct definition"); } - ProcessNodePass1(field.Group_TypeId, field.Name, state); + ProcessNodePass1(field.Group.TypeId, field.Name, state); } - if (processInterfaceMethods && node.Interface_Methods != null) - foreach (var method in node.Interface_Methods) + if (processInterfaceMethods && node.Interface.Methods != null) + foreach (var method in node.Interface.Methods) { var pnode = IdToNode(method.ParamStructType); if (pnode.ScopeId == 0) ProcessNodePass1(pnode.Id, null, state); // Anonymous generated type @@ -204,7 +206,7 @@ namespace CapnpC.CSharp.Generator.Model public HashSet processedNodes; } - void BuildPass2(Dictionary requestedFiles) + void BuildPass2(Dictionary requestedFiles) { var state = new Pass2State() { processedNodes = new HashSet() }; foreach (var file in _typeDefMgr.Files) @@ -214,7 +216,7 @@ namespace CapnpC.CSharp.Generator.Model } } - void ProcessNestedNodes(IEnumerable nestedNodes, Pass2State state, bool mustExist) + void ProcessNestedNodes(IEnumerable nestedNodes, Pass2State state, bool mustExist) { foreach (var nestedNode in nestedNodes) { @@ -222,16 +224,16 @@ namespace CapnpC.CSharp.Generator.Model } } - void ProcessBrand(Schema.Brand.Reader brandReader, Type type, Pass2State state) + void ProcessBrand(Schema.Brand.READER brandReader, Type type, Pass2State state) { foreach (var scopeReader in brandReader.Scopes) { var whatToBind = ProcessTypeDef(scopeReader.ScopeId, state); int index = 0; - switch (0) + switch (scopeReader.which) { - case 0 when scopeReader.IsBind: + case Schema.Brand.Scope.WHICH.Bind: foreach (var bindingReader in scopeReader.Bind) { var typeParameter = new GenericParameter() @@ -240,20 +242,20 @@ namespace CapnpC.CSharp.Generator.Model Index = index++ }; - switch (0) + switch (bindingReader.which) { - case 0 when bindingReader.IsType: + case Schema.Brand.Binding.WHICH.Type: type.BindGenericParameter(typeParameter, ProcessType(bindingReader.Type, state)); break; - case 0 when bindingReader.IsUnbound: + case Schema.Brand.Binding.WHICH.Unbound: type.BindGenericParameter(typeParameter, Types.FromParameter(typeParameter)); break; } } break; - case 0 when scopeReader.IsInherit: + case Schema.Brand.Scope.WHICH.Inherit: for (index = 0; index < type.DeclaringType.Definition.GenericParameters.Count; index++) { var typeParameter = new GenericParameter() @@ -269,45 +271,44 @@ namespace CapnpC.CSharp.Generator.Model } } - Type ProcessType(Schema.Type.Reader typeReader, Pass2State state) + Type ProcessType(Schema.Type.READER typeReader, Pass2State state) { Type result; - switch (0) + switch (typeReader.which) { - case 0 when typeReader.IsAnyPointer: - switch (0) + case Schema.Type.WHICH.AnyPointer: + switch (typeReader.AnyPointer.which) { - case 0 when typeReader.AnyPointer_IsParameter: + case Schema.Type.anyPointer.WHICH.Parameter: return Types.FromParameter( new GenericParameter() { - DeclaringEntity = ProcessTypeDef(typeReader.AnyPointer_Parameter_ScopeId, state), - Index = typeReader.AnyPointer_Parameter_ParameterIndex + DeclaringEntity = ProcessTypeDef(typeReader.AnyPointer.Parameter.ScopeId, state), + Index = typeReader.AnyPointer.Parameter.ParameterIndex }); - case 0 when typeReader.AnyPointer_IsImplicitMethodParameter: + case Schema.Type.anyPointer.WHICH.ImplicitMethodParameter: return Types.FromParameter( new GenericParameter() { DeclaringEntity = state.currentMethod ?? throw new InvalidOperationException("current method not set"), - Index = typeReader.AnyPointer_ImplicitMethodParameter_ParameterIndex + Index = typeReader.AnyPointer.ImplicitMethodParameter.ParameterIndex }); - case 0 when typeReader.AnyPointer_IsUnconstrained: - - switch (0) + case Schema.Type.anyPointer.WHICH.Unconstrained: + switch (typeReader.AnyPointer.Unconstrained.which) { - case 0 when typeReader.AnyPointer_Unconstrained_IsAnyKind: + case Schema.Type.anyPointer.unconstrained.WHICH.AnyKind: return Types.AnyPointer; - case 0 when typeReader.AnyPointer_Unconstrained_IsCapability: + case Schema.Type.anyPointer.unconstrained.WHICH.Capability: return Types.CapabilityPointer; - case 0 when typeReader.AnyPointer_Unconstrained_IsList: + case Schema.Type.anyPointer.unconstrained.WHICH.List: return Types.ListPointer; - case 0 when typeReader.AnyPointer_Unconstrained_IsStruct: + case Schema.Type.anyPointer.unconstrained.WHICH.Struct: return Types.StructPointer; default: @@ -318,62 +319,62 @@ namespace CapnpC.CSharp.Generator.Model throw new NotImplementedException(); } - case 0 when typeReader.IsBool: + case Schema.Type.WHICH.Bool: return Types.Bool; - case 0 when typeReader.IsData: + case Schema.Type.WHICH.Data: return Types.Data; - case 0 when typeReader.IsFloat64: + case Schema.Type.WHICH.Float64: return Types.F64; - case 0 when typeReader.IsEnum: - return Types.FromDefinition(ProcessTypeDef(typeReader.Enum_TypeId, state, TypeTag.Enum)); + case Schema.Type.WHICH.Enum: + return Types.FromDefinition(ProcessTypeDef(typeReader.Enum.TypeId, state, TypeTag.Enum)); - case 0 when typeReader.IsFloat32: + case Schema.Type.WHICH.Float32: return Types.F32; - case 0 when typeReader.IsInt16: + case Schema.Type.WHICH.Int16: return Types.S16; - case 0 when typeReader.IsInt32: + case Schema.Type.WHICH.Int32: return Types.S32; - case 0 when typeReader.IsInt64: + case Schema.Type.WHICH.Int64: return Types.S64; - case 0 when typeReader.IsInt8: + case Schema.Type.WHICH.Int8: return Types.S8; - case 0 when typeReader.IsInterface: - result = Types.FromDefinition(ProcessTypeDef(typeReader.Interface_TypeId, state, TypeTag.Interface)); - ProcessBrand(typeReader.Interface_Brand, result, state); + case Schema.Type.WHICH.Interface: + result = Types.FromDefinition(ProcessTypeDef(typeReader.Interface.TypeId, state, TypeTag.Interface)); + ProcessBrand(typeReader.Interface.Brand, result, state); return result; - case 0 when typeReader.IsList: - return Types.List(ProcessType(typeReader.List_ElementType, state)); + case Schema.Type.WHICH.List: + return Types.List(ProcessType(typeReader.List.ElementType, state)); - case 0 when typeReader.IsStruct: - result = Types.FromDefinition(ProcessTypeDef(typeReader.Struct_TypeId, state, TypeTag.Struct)); - ProcessBrand(typeReader.Struct_Brand, result, state); + case Schema.Type.WHICH.Struct: + result = Types.FromDefinition(ProcessTypeDef(typeReader.Struct.TypeId, state, TypeTag.Struct)); + ProcessBrand(typeReader.Struct.Brand, result, state); return result; - case 0 when typeReader.IsText: + case Schema.Type.WHICH.Text: return Types.Text; - case 0 when typeReader.IsUInt16: + case Schema.Type.WHICH.Uint16: return Types.U16; - case 0 when typeReader.IsUInt32: + case Schema.Type.WHICH.Uint32: return Types.U32; - case 0 when typeReader.IsUInt64: + case Schema.Type.WHICH.Uint64: return Types.U64; - case 0 when typeReader.IsUInt8: + case Schema.Type.WHICH.Uint8: return Types.U8; - case 0 when typeReader.IsVoid: + case Schema.Type.WHICH.Void: return Types.Void; default: @@ -381,103 +382,103 @@ namespace CapnpC.CSharp.Generator.Model } } - Value ProcessValue(Schema.Value.Reader valueReader) + Value ProcessValue(Schema.Value.READER valueReader) { var value = new Value(); - switch (0) + switch (valueReader.which) { - case 0 when valueReader.IsAnyPointer: + case Schema.Value.WHICH.AnyPointer: value.ScalarValue = valueReader.AnyPointer; value.Type = Types.AnyPointer; break; - case 0 when valueReader.IsBool: + case Schema.Value.WHICH.Bool: value.ScalarValue = valueReader.Bool; value.Type = Types.Bool; break; - case 0 when valueReader.IsData: - value.Items.AddRange(valueReader.Data.CastByte().Select(Value.Scalar)); + case Schema.Value.WHICH.Data: + value.Items.AddRange(valueReader.Data.Select(Value.Scalar)); value.Type = Types.Data; break; - case 0 when valueReader.IsEnum: + case Schema.Value.WHICH.Enum: value.ScalarValue = valueReader.Enum; value.Type = Types.AnyEnum; break; - case 0 when valueReader.IsFloat32: + case Schema.Value.WHICH.Float32: value.ScalarValue = valueReader.Float32; value.Type = Types.F32; break; - case 0 when valueReader.IsFloat64: + case Schema.Value.WHICH.Float64: value.ScalarValue = valueReader.Float64; value.Type = Types.F64; break; - case 0 when valueReader.IsInt16: + case Schema.Value.WHICH.Int16: value.ScalarValue = valueReader.Int16; value.Type = Types.S16; break; - case 0 when valueReader.IsInt32: + case Schema.Value.WHICH.Int32: value.ScalarValue = valueReader.Int32; value.Type = Types.S32; break; - case 0 when valueReader.IsInt64: + case Schema.Value.WHICH.Int64: value.ScalarValue = valueReader.Int64; value.Type = Types.S64; break; - case 0 when valueReader.IsInt8: + case Schema.Value.WHICH.Int8: value.ScalarValue = valueReader.Int8; value.Type = Types.S8; break; - case 0 when valueReader.IsInterface: + case Schema.Value.WHICH.Interface: value.ScalarValue = null; value.Type = Types.CapabilityPointer; break; - case 0 when valueReader.IsList: + case Schema.Value.WHICH.List: value.RawValue = valueReader.List; value.Type = Types.ListPointer; break; - case 0 when valueReader.IsStruct: + case Schema.Value.WHICH.Struct: value.RawValue = valueReader.Struct; value.Type = Types.StructPointer; break; - case 0 when valueReader.IsText: + case Schema.Value.WHICH.Text: value.ScalarValue = valueReader.Text; value.Type = Types.Text; break; - case 0 when valueReader.IsUInt16: - value.ScalarValue = valueReader.UInt16; + case Schema.Value.WHICH.Uint16: + value.ScalarValue = valueReader.Uint16; value.Type = Types.U16; break; - case 0 when valueReader.IsUInt32: - value.ScalarValue = valueReader.UInt32; + case Schema.Value.WHICH.Uint32: + value.ScalarValue = valueReader.Uint32; value.Type = Types.U32; break; - case 0 when valueReader.IsUInt64: - value.ScalarValue = valueReader.UInt64; + case Schema.Value.WHICH.Uint64: + value.ScalarValue = valueReader.Uint64; value.Type = Types.U64; break; - case 0 when valueReader.IsUInt8: - value.ScalarValue = valueReader.UInt8; + case Schema.Value.WHICH.Uint8: + value.ScalarValue = valueReader.Uint8; value.Type = Types.U8; break; - case 0 when valueReader.IsVoid: + case Schema.Value.WHICH.Void: value.Type = Types.Void; break; @@ -488,14 +489,14 @@ namespace CapnpC.CSharp.Generator.Model return value; } - void ProcessFields(Schema.Node.Reader reader, TypeDefinition declaringType, List fields, Pass2State state) + void ProcessFields(Schema.Node.READER reader, TypeDefinition declaringType, List fields, Pass2State state) { - if (reader.Fields == null) + if (reader.Struct.Fields == null) { return; } - foreach (var fieldReader in reader.Fields) + foreach (var fieldReader in reader.Struct.Fields) { var field = new Field() { @@ -505,25 +506,25 @@ namespace CapnpC.CSharp.Generator.Model CodeOrder = fieldReader.CodeOrder }; - if (fieldReader.DiscriminantValue != Schema.Field.Reader.NoDiscriminant) + if (fieldReader.DiscriminantValue != NoDiscriminant) { field.DiscValue = fieldReader.DiscriminantValue; } - switch (0) + switch (fieldReader.which) { - case 0 when fieldReader.IsGroup: - var def = ProcessTypeDef(fieldReader.Group_TypeId, state, TypeTag.Group); + case Schema.Field.WHICH.Group: + var def = ProcessTypeDef(fieldReader.Group.TypeId, state, TypeTag.Group); field.Type = Types.FromDefinition(def); def.CsName = field.CsName; // Type definitions for unions are artificially generated. // Transfer the C# name of the using field. break; - case 0 when fieldReader.IsSlot: - field.DefaultValue = ProcessValue(fieldReader.Slot_DefaultValue); - field.DefaultValueIsExplicit = fieldReader.Slot_HadExplicitDefault; - field.Offset = fieldReader.Slot_Offset; - field.Type = ProcessType(fieldReader.Slot_Type, state); + case Schema.Field.WHICH.Slot: + field.DefaultValue = ProcessValue(fieldReader.Slot.DefaultValue); + field.DefaultValueIsExplicit = fieldReader.Slot.HadExplicitDefault; + field.Offset = fieldReader.Slot.Offset; + field.Type = ProcessType(fieldReader.Slot.Type, state); field.DefaultValue.Type = field.Type; break; @@ -537,7 +538,7 @@ namespace CapnpC.CSharp.Generator.Model } } - TypeDefinition ProcessInterfaceOrStructTail(TypeDefinition def, Schema.Node.Reader reader, Pass2State state) + TypeDefinition ProcessInterfaceOrStructTail(TypeDefinition def, Schema.Node.READER reader, Pass2State state) { def.IsGeneric = reader.IsGeneric; @@ -553,9 +554,9 @@ namespace CapnpC.CSharp.Generator.Model ProcessFields(reader, def, def.Fields, state); - if (reader.IsInterface) + if (reader.which == Schema.Node.WHICH.Interface) { - foreach (var methodReader in reader.Interface_Methods) + foreach (var methodReader in reader.Interface.Methods) { var method = new Method() { @@ -608,22 +609,22 @@ namespace CapnpC.CSharp.Generator.Model return def; } - TypeDefinition ProcessStruct(Schema.Node.Reader structReader, TypeDefinition def, Pass2State state) + TypeDefinition ProcessStruct(Schema.Node.READER structReader, TypeDefinition def, Pass2State state) { - def.StructDataWordCount = structReader.Struct_DataWordCount; - def.StructPointerCount = structReader.Struct_PointerCount; + def.StructDataWordCount = structReader.Struct.DataWordCount; + def.StructPointerCount = structReader.Struct.PointerCount; - if (structReader.Struct_DiscriminantCount > 0) + if (structReader.Struct.DiscriminantCount > 0) { def.UnionInfo = new TypeDefinition.DiscriminationInfo( - structReader.Struct_DiscriminantCount, - 16u * structReader.Struct_DiscriminantOffset); + structReader.Struct.DiscriminantCount, + 16u * structReader.Struct.DiscriminantOffset); } return ProcessInterfaceOrStructTail(def, structReader, state); } - TypeDefinition ProcessParameterList(Schema.Node.Reader reader, Schema.Brand.Reader brandReader, List list, Pass2State state) + TypeDefinition ProcessParameterList(Schema.Node.READER reader, Schema.Brand.READER brandReader, List list, Pass2State state) { //# If a named parameter list was specified in the method //# declaration (rather than a single struct parameter type) then a corresponding struct type is @@ -633,7 +634,7 @@ namespace CapnpC.CSharp.Generator.Model //# this a situation where you can't just climb the scope chain to find where a particular //# generic parameter was introduced. Making the `scopeId` zero was a mistake.) - if (!reader.IsStruct) + if (reader.which != Schema.Node.WHICH.Struct) { throw new InvalidSchemaException("Expected a struct"); } @@ -657,9 +658,9 @@ namespace CapnpC.CSharp.Generator.Model } } - TypeDefinition ProcessInterface(Schema.Node.Reader ifaceReader, TypeDefinition def, Pass2State state) + TypeDefinition ProcessInterface(Schema.Node.READER ifaceReader, TypeDefinition def, Pass2State state) { - foreach (var superClassReader in ifaceReader.Interface_Superclasses) + foreach (var superClassReader in ifaceReader.Interface.Superclasses) { var superClass = Types.FromDefinition(ProcessTypeDef(superClassReader.Id, state, TypeTag.Interface)); ProcessBrand(superClassReader.Brand, superClass, state); @@ -669,9 +670,9 @@ namespace CapnpC.CSharp.Generator.Model return ProcessInterfaceOrStructTail(def, ifaceReader, state); } - TypeDefinition ProcessEnum(Schema.Node.Reader enumReader, TypeDefinition def, Pass2State state) + TypeDefinition ProcessEnum(Schema.Node.READER enumReader, TypeDefinition def, Pass2State state) { - foreach (var fieldReader in enumReader.Enumerants) + foreach (var fieldReader in enumReader.Enum.Enumerants) { var field = new Enumerant() { @@ -681,20 +682,15 @@ namespace CapnpC.CSharp.Generator.Model CodeOrder = fieldReader.CodeOrder }; - if (fieldReader.Ordinal_IsExplicit) - { - field.Ordinal = fieldReader.Ordinal_Explicit; - } - def.Enumerants.Add(field); } return def; } - Constant ProcessConst(Schema.Node.Reader constReader, Constant @const, Pass2State state) + Constant ProcessConst(Schema.Node.READER constReader, Constant @const, Pass2State state) { - var value = ProcessValue(constReader.Const_Value); - value.Type = ProcessType(constReader.Const_Type, state); + var value = ProcessValue(constReader.Const.Value); + value.Type = ProcessType(constReader.Const.Type, state); @const.Value = value; return @const; } @@ -712,7 +708,7 @@ namespace CapnpC.CSharp.Generator.Model IDefinition ProcessNode(ulong id, Pass2State state, bool mustExist, TypeTag tag = default) { - if (!(IdToNode(id, mustExist) is Schema.Node.Reader node)) return null; + if (!(IdToNode(id, mustExist) is Schema.Node.READER node)) return null; var kind = node.GetKind(); if (tag == TypeTag.Unknown) tag = kind.GetTypeTag(); var def = _typeDefMgr.GetExistingDef(id, tag); @@ -737,7 +733,7 @@ namespace CapnpC.CSharp.Generator.Model } } - public static SchemaModel Create(Schema.CodeGeneratorRequest.Reader request) + public static SchemaModel Create(Schema.CodeGeneratorRequest.READER request) { var model = new SchemaModel(request); model.Build(); @@ -759,22 +755,24 @@ namespace CapnpC.CSharp.Generator.Model public static class SchemaExtensions { - public static string StrId(this Schema.Node.Reader node) + public static string StrId(this Schema.Node.READER node) => $"0x{node.Id:X}"; public static string StrId(this ulong nodeId) => $"0x{nodeId:X}"; - public static NodeKind GetKind(this Schema.Node.Reader node) + public static NodeKind GetKind(this Schema.Node.READER node) { - if (node.IsStruct) - return node.Struct_IsGroup ? NodeKind.Group : NodeKind.Struct; - if (node.IsInterface) return NodeKind.Interface; - if (node.IsEnum) return NodeKind.Enum; - if (node.IsConst) return NodeKind.Const; - if (node.IsAnnotation) return NodeKind.Annotation; - if (node.IsFile) return NodeKind.File; - return NodeKind.Unknown; + switch (node.which) + { + case Schema.Node.WHICH.Struct: return node.Struct.IsGroup ? NodeKind.Group : NodeKind.Struct; + case Schema.Node.WHICH.Interface: return NodeKind.Interface; + case Schema.Node.WHICH.Enum: return NodeKind.Enum; + case Schema.Node.WHICH.Const: return NodeKind.Const; + case Schema.Node.WHICH.Annotation: return NodeKind.Annotation; + case Schema.Node.WHICH.File: return NodeKind.File; + default: return NodeKind.Unknown; + } } internal static TypeTag GetTypeTag(this NodeKind kind) @@ -789,7 +787,6 @@ namespace CapnpC.CSharp.Generator.Model } } - internal static TypeTag GetTypeTag(this Schema.Node.Reader node) - => node.GetKind().GetTypeTag(); + internal static TypeTag GetTypeTag(this Schema.Node.READER node) => node.GetKind().GetTypeTag(); } } diff --git a/CapnpC.CSharp.Generator/Model/SupportedAnnotations.cs b/CapnpC.CSharp.Generator/Model/SupportedAnnotations.cs index 5985170..feb3980 100644 --- a/CapnpC.CSharp.Generator/Model/SupportedAnnotations.cs +++ b/CapnpC.CSharp.Generator/Model/SupportedAnnotations.cs @@ -31,7 +31,7 @@ namespace CapnpC.CSharp.Generator.Model Internal = 1 } - public static string[] GetNamespaceAnnotation(Schema.Node.Reader fileNode) + public static string[] GetNamespaceAnnotation(Schema.Node.READER fileNode) { foreach (var annotation in fileNode.Annotations) { @@ -48,7 +48,7 @@ namespace CapnpC.CSharp.Generator.Model return null; } - public static string GetCsName(Schema.Field.Reader node) + public static string GetCsName(Schema.Field.READER node) { foreach (var annotation in node.Annotations) { @@ -60,7 +60,7 @@ namespace CapnpC.CSharp.Generator.Model return null; } - public static string GetCsName(Schema.Node.Reader node) + public static string GetCsName(Schema.Enumerant.READER node) { foreach (var annotation in node.Annotations) { @@ -72,7 +72,7 @@ namespace CapnpC.CSharp.Generator.Model return null; } - public static string GetCsName(Schema.Method.Reader node) + public static string GetCsName(Schema.Node.READER node) { foreach (var annotation in node.Annotations) { @@ -84,11 +84,23 @@ namespace CapnpC.CSharp.Generator.Model return null; } - public static bool? GetNullableEnable(Schema.Node.Reader node) + public static string GetCsName(Schema.Method.READER node) { foreach (var annotation in node.Annotations) { - if (annotation.Id == AnnotationIds.Cs.NullableEnable && annotation.Value.IsBool) + if (annotation.Id == AnnotationIds.Cs.Name) + { + return annotation.Value.Text; + } + } + return null; + } + + public static bool? GetNullableEnable(Schema.Node.READER node) + { + foreach (var annotation in node.Annotations) + { + if (annotation.Id == AnnotationIds.Cs.NullableEnable && annotation.Value.which == Schema.Value.WHICH.Bool) { return annotation.Value.Bool; } @@ -96,11 +108,11 @@ namespace CapnpC.CSharp.Generator.Model return null; } - public static bool? GetEmitNullableDirective(Schema.Node.Reader node) + public static bool? GetEmitNullableDirective(Schema.Node.READER node) { foreach (var annotation in node.Annotations) { - if (annotation.Id == AnnotationIds.Cs.EmitNullableDirective && annotation.Value.IsBool) + if (annotation.Id == AnnotationIds.Cs.EmitNullableDirective && annotation.Value.which == Schema.Value.WHICH.Bool) { return annotation.Value.Bool; } @@ -108,11 +120,11 @@ namespace CapnpC.CSharp.Generator.Model return null; } - public static bool? GetEmitDomainClassesAndInterfaces(Schema.Node.Reader node) + public static bool? GetEmitDomainClassesAndInterfaces(Schema.Node.READER node) { foreach (var annotation in node.Annotations) { - if (annotation.Id == AnnotationIds.Cs.EmitDomainClassesAndInterfaces && annotation.Value.IsBool) + if (annotation.Id == AnnotationIds.Cs.EmitDomainClassesAndInterfaces && annotation.Value.which == Schema.Value.WHICH.Bool) { return annotation.Value.Bool; } @@ -120,11 +132,11 @@ namespace CapnpC.CSharp.Generator.Model return null; } - public static TypeVisibility? GetTypeVisibility(Schema.Node.Reader node) + public static TypeVisibility? GetTypeVisibility(Schema.Node.READER node) { foreach (var annotation in node.Annotations) { - if (annotation.Id == AnnotationIds.Cs.TypeVisibility && annotation.Value.IsEnum) + if (annotation.Id == AnnotationIds.Cs.TypeVisibility && annotation.Value.which == Schema.Value.WHICH.Enum) { return (TypeVisibility)annotation.Value.Enum; } diff --git a/CapnpC.CSharp.Generator/Schema/SchemaSerialization.cs b/CapnpC.CSharp.Generator/Schema/SchemaSerialization.cs index 0655f7d..81729b4 100644 --- a/CapnpC.CSharp.Generator/Schema/SchemaSerialization.cs +++ b/CapnpC.CSharp.Generator/Schema/SchemaSerialization.cs @@ -1,1575 +1,4381 @@ -using Capnp; +#pragma warning disable CS1591 +using Capnp; +using Capnp.Rpc; +using System; +using System.CodeDom.Compiler; using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; namespace CapnpC.CSharp.Generator.Schema { - namespace Superclass + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xe682ab4cf923a417UL)] + public class Node : ICapnpSerializable { - public struct Reader + public const UInt64 typeId = 0xe682ab4cf923a417UL; + public enum WHICH : ushort { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ulong Id => State.ReadDataULong(0); - public Brand.Reader Brand => State.ReadStruct(0, Schema.Brand.Reader.Create); + File = 0, + Struct = 1, + Enum = 2, + Interface = 3, + Const = 4, + Annotation = 5, + undefined = 65535 } - public class Writer: SerializerState + void ICapnpSerializable.Deserialize(DeserializerState arg_) { - public Writer() + var reader = READER.create(arg_); + switch (reader.which) { - SetStruct(1, 1); + case WHICH.File: + which = reader.which; + break; + case WHICH.Struct: + Struct = CapnpSerializable.Create(reader.Struct); + break; + case WHICH.Enum: + Enum = CapnpSerializable.Create(reader.Enum); + break; + case WHICH.Interface: + Interface = CapnpSerializable.Create(reader.Interface); + break; + case WHICH.Const: + Const = CapnpSerializable.Create(reader.Const); + break; + case WHICH.Annotation: + Annotation = CapnpSerializable.Create(reader.Annotation); + break; + } + + Id = reader.Id; + DisplayName = reader.DisplayName; + DisplayNamePrefixLength = reader.DisplayNamePrefixLength; + ScopeId = reader.ScopeId; + NestedNodes = reader.NestedNodes?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + Annotations = reader.Annotations?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + Parameters = reader.Parameters?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + IsGeneric = reader.IsGeneric; + applyDefaults(); + } + + private WHICH _which = WHICH.undefined; + private object _content; + public WHICH which + { + get => _which; + set + { + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.File: + break; + case WHICH.Struct: + _content = null; + break; + case WHICH.Enum: + _content = null; + break; + case WHICH.Interface: + _content = null; + break; + case WHICH.Const: + _content = null; + break; + case WHICH.Annotation: + _content = null; + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.File: + break; + case WHICH.Struct: + Struct?.serialize(writer.Struct); + break; + case WHICH.Enum: + Enum?.serialize(writer.Enum); + break; + case WHICH.Interface: + Interface?.serialize(writer.Interface); + break; + case WHICH.Const: + Const?.serialize(writer.Const); + break; + case WHICH.Annotation: + Annotation?.serialize(writer.Annotation); + break; + } + + writer.Id = Id; + writer.DisplayName = DisplayName; + writer.DisplayNamePrefixLength = DisplayNamePrefixLength; + writer.ScopeId = ScopeId; + writer.NestedNodes.Init(NestedNodes, (_s1, _v1) => _v1?.serialize(_s1)); + writer.Annotations.Init(Annotations, (_s1, _v1) => _v1?.serialize(_s1)); + writer.Parameters.Init(Parameters, (_s1, _v1) => _v1?.serialize(_s1)); + writer.IsGeneric = IsGeneric; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong Id + { + get; + set; + } + + public string DisplayName + { + get; + set; + } + + public uint DisplayNamePrefixLength + { + get; + set; + } + + public ulong ScopeId + { + get; + set; + } + + public IReadOnlyList NestedNodes + { + get; + set; + } + + public IReadOnlyList Annotations + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Node.@struct Struct + { + get => _which == WHICH.Struct ? (CapnpC.CSharp.Generator.Schema.Node.@struct)_content : null; + set + { + _which = WHICH.Struct; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Node.@enum Enum + { + get => _which == WHICH.Enum ? (CapnpC.CSharp.Generator.Schema.Node.@enum)_content : null; + set + { + _which = WHICH.Enum; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Node.@interface Interface + { + get => _which == WHICH.Interface ? (CapnpC.CSharp.Generator.Schema.Node.@interface)_content : null; + set + { + _which = WHICH.Interface; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Node.@const Const + { + get => _which == WHICH.Const ? (CapnpC.CSharp.Generator.Schema.Node.@const)_content : null; + set + { + _which = WHICH.Const; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Node.annotation Annotation + { + get => _which == WHICH.Annotation ? (CapnpC.CSharp.Generator.Schema.Node.annotation)_content : null; + set + { + _which = WHICH.Annotation; + _content = value; + } + } + + public IReadOnlyList Parameters + { + get; + set; + } + + public bool IsGeneric + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(96U, (ushort)0); + public ulong Id => ctx.ReadDataULong(0UL, 0UL); + public string DisplayName => ctx.ReadText(0, null); + public uint DisplayNamePrefixLength => ctx.ReadDataUInt(64UL, 0U); + public ulong ScopeId => ctx.ReadDataULong(128UL, 0UL); + public IReadOnlyList NestedNodes => ctx.ReadList(1).Cast(CapnpC.CSharp.Generator.Schema.Node.NestedNode.READER.create); + public IReadOnlyList Annotations => ctx.ReadList(2).Cast(CapnpC.CSharp.Generator.Schema.Annotation.READER.create); + public @struct.READER Struct => which == WHICH.Struct ? new @struct.READER(ctx) : default; + public @enum.READER Enum => which == WHICH.Enum ? new @enum.READER(ctx) : default; + public @interface.READER Interface => which == WHICH.Interface ? new @interface.READER(ctx) : default; + public @const.READER Const => which == WHICH.Const ? new @const.READER(ctx) : default; + public annotation.READER Annotation => which == WHICH.Annotation ? new annotation.READER(ctx) : default; + public IReadOnlyList Parameters => ctx.ReadList(5).Cast(CapnpC.CSharp.Generator.Schema.Node.Parameter.READER.create); + public bool IsGeneric => ctx.ReadDataBool(288UL, false); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(5, 6); + } + + public WHICH which + { + get => (WHICH)this.ReadDataUShort(96U, (ushort)0); + set => this.WriteData(96U, (ushort)value, (ushort)0); } public ulong Id { - get => this.ReadDataULong(0); - set => this.WriteData(0, value); - } - - public Brand.Writer Brand - { - get => BuildPointer(0); - set => Link(0, value); - } - } - } - - namespace Method - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public string Name => State.ReadText(0); - public ushort CodeOrder => State.ReadDataUShort(0); - public IReadOnlyList ImplicitParameters => State.ReadListOfStructs(4, Node.Parameter.Reader.Create); - public ulong ParamStructType => State.ReadDataULong(64); - public Brand.Reader ParamBrand => State.ReadStruct(2, Brand.Reader.Create); - public ulong ResultStructType => State.ReadDataULong(128); - public Brand.Reader ResultBrand => State.ReadStruct(3, Brand.Reader.Create); - public IReadOnlyList Annotations => State.ReadListOfStructs(1, Annotation.Reader.Create); - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(5, 3); - } - - public string Name - { - get => ReadText(0); - set => WriteText(0, value); - } - - public ushort CodeOrder - { - get => this.ReadDataUShort(0); - set => this.WriteData(0, value); - } - - public ListOfStructsSerializer ImplicitParameters - { - get => BuildPointer>(4); - set => Link(4, value); - } - - public ref ulong ParamStructType => ref this.RefData(8); - - public Brand.Writer ParamBrand - { - get => BuildPointer(2); - set => Link(2, value); - } - - public ulong ResultStructType - { - get => this.ReadDataULong(128); - set => this.WriteData(128, value); - } - - public Brand.Writer ResultBrand - { - get => BuildPointer(3); - set => Link(3, value); - } - - public ListOfStructsSerializer Annotations - { - get => BuildPointer>(1); - set => Link(1, value); - } - } - } - - namespace Type - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ushort Tag => State.ReadDataUShort(0); - public bool IsVoid => Tag == 0; - public bool IsBool => Tag == 1; - public bool IsInt8 => Tag == 2; - public bool IsInt16 => Tag == 3; - public bool IsInt32 => Tag == 4; - public bool IsInt64 => Tag == 5; - public bool IsUInt8 => Tag == 6; - public bool IsUInt16 => Tag == 7; - public bool IsUInt32 => Tag == 8; - public bool IsUInt64 => Tag == 9; - public bool IsFloat32 => Tag == 10; - public bool IsFloat64 => Tag == 11; - public bool IsText => Tag == 12; - public bool IsData => Tag == 13; - public bool IsList => Tag == 14; - public Reader List_ElementType => IsList ? State.ReadStruct(0, Create) : default; - public bool IsEnum => Tag == 15; - public ulong Enum_TypeId => IsEnum ? State.ReadDataULong(64) : 0; - public Brand.Reader Enum_Brand => IsEnum ? State.ReadStruct(0, Brand.Reader.Create) : default; - public bool IsStruct => Tag == 16; - public ulong Struct_TypeId => IsStruct ? State.ReadDataULong(64) : 0; - public Brand.Reader Struct_Brand => IsStruct ? State.ReadStruct(0, Brand.Reader.Create) : default; - public bool IsInterface => Tag == 17; - public ulong Interface_TypeId => IsInterface ? State.ReadDataULong(64) : 0; - public Brand.Reader Interface_Brand => IsInterface ? State.ReadStruct(0, Brand.Reader.Create) : default; - public bool IsAnyPointer => Tag == 18; - public ushort AnyPointer_Tag => IsAnyPointer ? State.ReadDataUShort(64) : default; - public bool AnyPointer_IsUnconstrained => IsAnyPointer && AnyPointer_Tag == 0; - public ushort AnyPointer_Unconstrained_Tag => AnyPointer_IsUnconstrained ? State.ReadDataUShort(80) : (ushort)0; - public bool AnyPointer_Unconstrained_IsAnyKind => AnyPointer_IsUnconstrained && AnyPointer_Unconstrained_Tag == 0; - public bool AnyPointer_Unconstrained_IsStruct => AnyPointer_IsUnconstrained && AnyPointer_Unconstrained_Tag == 1; - public bool AnyPointer_Unconstrained_IsList => AnyPointer_IsUnconstrained && AnyPointer_Unconstrained_Tag == 2; - public bool AnyPointer_Unconstrained_IsCapability => AnyPointer_IsUnconstrained && AnyPointer_Unconstrained_Tag == 3; - public bool AnyPointer_IsParameter => IsAnyPointer && AnyPointer_Tag == 1; - public ulong AnyPointer_Parameter_ScopeId => AnyPointer_IsParameter ? State.ReadDataULong(128) : 0; - public ushort AnyPointer_Parameter_ParameterIndex => AnyPointer_IsParameter ? State.ReadDataUShort(80) : (ushort)0; - public bool AnyPointer_IsImplicitMethodParameter => AnyPointer_Tag == 2; - public ushort AnyPointer_ImplicitMethodParameter_ParameterIndex => AnyPointer_IsImplicitMethodParameter ? State.ReadDataUShort(80) : default; - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(3, 1); - } - - public ref ushort Tag => ref this.RefData(0); - - public bool IsVoid - { - get => Tag == 0; - set => Tag = 0; - } - - public bool IsBool - { - get => Tag == 1; - set => Tag = 1; - } - - public bool IsInt8 - { - get => Tag == 2; - set => Tag = 2; - } - - public bool IsInt16 - { - get => Tag == 3; - set => Tag = 3; - } - - public bool IsInt32 - { - get => Tag == 4; - set => Tag = 4; - } - - public bool IsInt64 - { - get => Tag == 5; - set => Tag = 5; - } - - public bool IsUInt8 - { - get => Tag == 6; - set => Tag = 6; - } - - public bool IsUInt16 - { - get => Tag == 7; - set => Tag = 7; - } - - public bool IsUInt32 - { - get => Tag == 8; - set => Tag = 8; - } - - public bool IsUInt64 - { - get => Tag == 9; - set => Tag = 9; - } - - public bool IsFloat32 - { - get => Tag == 10; - set => Tag = 10; - } - - public bool IsFloat64 - { - get => Tag == 11; - set => Tag = 11; - } - - public bool IsText - { - get => Tag == 12; - set => Tag = 12; - } - - public bool IsData - { - get => Tag == 13; - set => Tag = 13; - } - - public bool IsList - { - get => Tag == 14; - set => Tag = 14; - } - - public Writer List_ElementType - { - get => IsList ? BuildPointer(0) : default; - set { Link(0, value); } - } - - public bool IsEnum - { - get => Tag == 15; - set => Tag = 15; - } - - public ulong Enum_TypeId - { - get => IsEnum ? this.ReadDataULong(64) : 0; - set { this.WriteData(64, value); } - } - - public Brand.Writer Enum_Brand - { - get => IsEnum ? BuildPointer(0) : default; - set => Link(0, value); - } - - public bool IsStruct - { - get => Tag == 16; - set => Tag = 16; - } - - public ulong Struct_TypeId - { - get => IsStruct ? this.ReadDataULong(64) : 0; - set => this.WriteData(64, value); - } - - public Brand.Writer Struct_Brand - { - get => IsStruct ? BuildPointer(0) : default; - set => Link(0, value); - } - - public bool IsInterface - { - get => Tag == 17; - set => Tag = 17; - } - - public ulong Interface_TypeId - { - get => IsStruct ? this.ReadDataULong(64) : 0; - set => this.WriteData(64, value); - } - - public Brand.Writer Interface_Brand - { - get => IsStruct ? BuildPointer(0) : default; - set => Link(0, value); - } - - public bool IsAnyPointer - { - get => Tag == 18; - set => Tag = 18; - } - - public ushort AnyPointer_Tag - { - get => IsAnyPointer ? this.ReadDataUShort(64) : default; - set => this.WriteData(64, value); - } - - public bool AnyPointer_IsUnconstrained - { - get => IsAnyPointer && AnyPointer_Tag == 0; - set => AnyPointer_Tag = 0; - } - - public ushort AnyPointer_Unconstrained_Tag - { - get => AnyPointer_IsUnconstrained ? this.ReadDataUShort(80) : (ushort)0; - set => this.WriteData(80, value); - } - - public bool AnyPointer_Unconstrained_IsAnyKind - { - get => AnyPointer_IsUnconstrained && AnyPointer_Unconstrained_Tag == 0; - set => AnyPointer_Unconstrained_Tag = 0; - } - - public bool AnyPointer_Unconstrained_IsStruct - { - get => AnyPointer_IsUnconstrained && AnyPointer_Unconstrained_Tag == 1; - set => AnyPointer_Unconstrained_Tag = 1; - } - - public bool AnyPointer_Unconstrained_IsList - { - get => AnyPointer_IsUnconstrained && AnyPointer_Unconstrained_Tag == 2; - set => AnyPointer_Unconstrained_Tag = 2; - } - - public bool AnyPointer_Unconstrained_IsCapability - { - get => AnyPointer_IsUnconstrained && AnyPointer_Unconstrained_Tag == 3; - set => AnyPointer_Unconstrained_Tag = 3; - } - - public bool AnyPointer_IsParameter - { - get => IsAnyPointer && AnyPointer_Tag == 1; - set => AnyPointer_Tag = 1; - } - - public ulong AnyPointer_Parameter_ScopeId - { - get => AnyPointer_IsParameter ? this.ReadDataULong(128) : 0; - set => this.WriteData(128, value); - } - - public ushort AnyPointer_Parameter_ParameterIndex - { - get => AnyPointer_IsParameter ? this.ReadDataUShort(80) : (ushort)0; - set => this.WriteData(80, value); - } - - public bool AnyPointer_IsImplicitMethodParameter - { - get => AnyPointer_Tag == 2; - set => AnyPointer_Tag = 2; - } - - public ushort AnyPointer_ImplicitMethodParameter_ParameterIndex - { - get => AnyPointer_IsImplicitMethodParameter ? this.ReadDataUShort(80) : default; - set => this.WriteData(80, value); - } - } - } - - namespace Brand - { - namespace Scope - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ulong ScopeId => State.ReadDataULong(0); - public ushort Tag => State.ReadDataUShort(64); - public bool IsBind => Tag == 0; - public IReadOnlyList Bind => IsBind ? State.ReadListOfStructs(0, Binding.Reader.Create) : null; - public bool IsInherit => Tag == 1; - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(2, 1); - } - - public ulong ScopeId - { - get => this.ReadDataULong(0); - set => this.WriteData(0, value); - } - - public ushort Tag - { - get => this.ReadDataUShort(64); - set => this.WriteData(64, value); - } - - public bool IsBind - { - get => Tag == 0; - set => Tag = 0; - } - - public ListOfStructsSerializer Bind - { - get => IsBind ? BuildPointer>(0) : default; - set => Link(0, value); - } - - public bool IsInherit - { - get => Tag == 1; - set => Tag = 1; - } - } - - namespace Binding - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ushort Tag => State.ReadDataUShort(0); - public bool IsUnbound => Tag == 0; - public bool IsType => Tag == 1; - public Type.Reader Type => IsType ? State.ReadStruct(0, Schema.Type.Reader.Create) : default; - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(1, 1); - } - - public ushort Tag - { - get => this.ReadDataUShort(0); - set => this.WriteData(0, value); - } - - public bool IsUnbound - { - get => Tag == 0; - set => Tag = 0; - } - - public bool IsType - { - get => Tag == 1; - set => Tag = 1; - } - - public Type.Writer Type - { - get => IsType ? BuildPointer(0) : default; - set => Link(0, value); - } - } - } - } - - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public IReadOnlyList Scopes => State.ReadListOfStructs(0, Scope.Reader.Create); - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(0, 1); - } - - public ListOfStructsSerializer Scopes - { - get => BuildPointer>(0); - set => Link(0, value); - } - } - } - - namespace Value - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ushort Tag => State.ReadDataUShort(0); - public bool IsVoid => Tag == 0; - public bool IsBool => Tag == 1; - public bool Bool => IsBool ? State.ReadDataBool(16) : default; - public bool IsInt8 => Tag == 2; - public sbyte Int8 => IsInt8 ? State.ReadDataSByte(16) : default; - public bool IsInt16 => Tag == 3; - public short Int16 => IsInt16 ? State.ReadDataShort(16) : default; - public bool IsInt32 => Tag == 4; - public int Int32 => IsInt32 ? State.ReadDataInt(32) : default; - public bool IsInt64 => Tag == 5; - public long Int64 => IsInt64 ? State.ReadDataLong(64) : default; - public bool IsUInt8 => Tag == 6; - public byte UInt8 => IsUInt8 ? State.ReadDataByte(16) : default; - public bool IsUInt16 => Tag == 7; - public ushort UInt16 => IsUInt16 ? State.ReadDataUShort(16) : default; - public bool IsUInt32 => Tag == 8; - public uint UInt32 => IsUInt32 ? State.ReadDataUInt(32) : default; - public bool IsUInt64 => Tag == 9; - public ulong UInt64 => IsUInt64 ? State.ReadDataULong(64) : default; - public bool IsFloat32 => Tag == 10; - public float Float32 => IsFloat32 ? State.ReadDataFloat(32) : default; - public bool IsFloat64 => Tag == 11; - public double Float64 => IsFloat64 ? State.ReadDataDouble(64) : default; - public bool IsText => Tag == 12; - public string Text => IsText ? State.ReadText(0) : default; - public bool IsData => Tag == 13; - public ListDeserializer Data => IsData ? State.ReadList(0) : default; - public bool IsList => Tag == 14; - public DeserializerState List => IsList ? State.StructReadPointer(0) : default; - public bool IsEnum => Tag == 15; - public ushort Enum => IsEnum ? State.ReadDataUShort(16) : default; - public bool IsStruct => Tag == 16; - public DeserializerState Struct => IsStruct ? State.StructReadPointer(0) : default; - public bool IsInterface => Tag == 17; - public bool IsAnyPointer => Tag == 18; - public DeserializerState AnyPointer => IsAnyPointer ? State.StructReadPointer(0) : default; - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(2, 1); - } - - public ushort Tag - { - get => this.ReadDataUShort(0); - set => this.WriteData(0, value); - } - - public bool IsVoid - { - get => Tag == 0; - set => Tag = 0; - } - - public bool IsBool - { - get => Tag == 1; - set => Tag = 1; - } - - public bool Bool - { - get => IsBool ? this.ReadDataBool(16) : default; - set => this.WriteData(16, value); - } - - public bool IsInt8 - { - get => Tag == 2; - set => Tag = 2; - } - - public sbyte Int8 - { - get => IsInt8 ? this.ReadDataSByte(16) : default; - set => this.WriteData(16, value); - } - - public bool IsInt16 - { - get => Tag == 3; - set => Tag = 3; - } - - public short Int16 - { - get => IsInt16 ? this.ReadDataShort(16) : default; - set => this.WriteData(16, value); - } - - public bool IsInt32 - { - get => Tag == 4; - set => Tag = 4; - } - - public int Int32 - { - get => IsInt32 ? this.ReadDataInt(32) : default; - set => this.WriteData(32, value); - } - - public bool IsInt64 - { - get => Tag == 5; - set => Tag = 5; - } - - public long Int64 - { - get => IsInt64 ? this.ReadDataLong(64) : default; - set => this.WriteData(64, value); - } - - public bool IsUInt8 - { - get => Tag == 6; - set => Tag = 6; - } - - public byte UInt8 - { - get => IsUInt8 ? this.ReadDataByte(16) : default; - set => this.WriteData(16, value); - } - - public bool IsUInt16 - { - get => Tag == 7; - set => Tag = 7; - } - - public ushort UInt16 - { - get => IsUInt16 ? this.ReadDataUShort(16) : default; - set => this.WriteData(16, value); - } - - public bool IsUInt32 - { - get => Tag == 8; - set => Tag = 8; - } - - public uint UInt32 - { - get => IsUInt32 ? this.ReadDataUInt(32) : default; - set => this.WriteData(32, value); - } - - public bool IsUInt64 - { - get => Tag == 9; - set => Tag = 9; - } - - public ulong UInt64 - { - get => IsUInt64 ? this.ReadDataULong(64) : default; - set => this.WriteData(64, value); - } - - public bool IsFloat32 - { - get => Tag == 10; - set => Tag = 10; - } - - public float Float32 - { - get => IsFloat32 ? this.ReadDataFloat(32) : default; - set => this.WriteData(32, value); - } - - public bool IsFloat64 - { - get => Tag == 11; - set => Tag = 11; - } - - public double Float64 - { - get => IsFloat64 ? this.ReadDataDouble(64) : default; - set => this.WriteData(64, value); - } - - public bool IsText - { - get => Tag == 12; - set => Tag = 12; - } - - public string Text - { - get => IsText ? ReadText(0) : default; - set => WriteText(0, value); - } - - public bool IsData - { - get => Tag == 13; - set => Tag = 13; - } - - public SerializerState Data - { - get => IsData ? BuildPointer(0) : default; - set => Link(0, value); - } - - public bool IsList - { - get => Tag == 14; - set => Tag = 14; - } - - public SerializerState List - { - get => IsList ? BuildPointer(0) : default; - set => Link(0, value); - } - - public bool IsEnum - { - get => Tag == 15; - set => Tag = 15; - } - - public ushort Enum - { - get => IsEnum ? this.ReadDataUShort(16) : default; - set => this.WriteData(16, value); - } - - public bool IsStruct - { - get => Tag == 16; - set => Tag = 16; - } - - public SerializerState Struct - { - get => IsStruct ? BuildPointer(0) : default; - set => Link(0, value); - } - - public bool IsInterface - { - get => Tag == 17; - set => Tag = 17; - } - - public bool IsAnyPointer - { - get => Tag == 18; - set => Tag = 18; - } - - public SerializerState AnyPointer - { - get => IsAnyPointer ? BuildPointer(0) : default; - set => Link(0, value); - } - } - } - - namespace Annotation - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ulong Id => State.ReadDataULong(0); - public Brand.Reader Brand => State.ReadStruct(1, Schema.Brand.Reader.Create); - public Value.Reader Value => State.ReadStruct(0, Schema.Value.Reader.Create); - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(1, 2); - } - - public ref ulong Id => ref this.RefData(0); - - public Brand.Writer Brand - { - get => BuildPointer(1); - set => Link(1, value); - } - - public Value.Writer Value - { - get => BuildPointer(0); - set => Link(0, value); - } - } - } - - public enum ElementSize: ushort - { - Empty = 0, - Bit = 1, - Byte = 2, - TwoBytes = 3, - FourBytes = 4, - EightBytes = 5, - Pointer = 6, - InlineComposite = 7 - } - - namespace Field - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public string Name => State.ReadText(0); - public ushort CodeOrder => State.ReadDataUShort(0); - public IReadOnlyList Annotations => State.ReadListOfStructs(1, Annotation.Reader.Create); - public ushort DiscriminantValue => State.ReadDataUShort(16, 65535); - public ushort Tag => State.ReadDataUShort(64); - public bool IsSlot => Tag == 0; - public uint Slot_Offset => IsSlot ? State.ReadDataUInt(32) : default; - public Type.Reader Slot_Type => IsSlot ? State.ReadStruct(2, Type.Reader.Create) : default; - public Value.Reader Slot_DefaultValue => IsSlot ? State.ReadStruct(3, Value.Reader.Create) : default; - public bool Slot_HadExplicitDefault => IsSlot ? State.ReadDataBool(128) : default; - public bool IsGroup => Tag == 1; - public ulong Group_TypeId => IsGroup ? State.ReadDataULong(128) : default; - public ushort Ordinal_Tag => State.ReadDataUShort(80); - public bool Ordinal_IsImplicit => Ordinal_Tag == 0; - public bool Ordinal_IsExplicit => Ordinal_Tag == 1; - public ushort Ordinal_Explicit => Ordinal_IsExplicit ? State.ReadDataUShort(96) : default; - - public const ushort NoDiscriminant = 0xffff; - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(3, 3); - } - - public string Name - { - get => ReadText(0); - set => WriteText(0, value); - } - - public ref ushort CodeOrder => ref this.RefData(0); - - public ListOfStructsSerializer Annotations - { - get => BuildPointer>(1); - set => Link(1, value); - } - - public ushort DiscriminantValue - { - get => this.ReadDataUShort(16, 65535); - set => this.WriteData(16, value, (ushort)65535); - } - - public ref ushort Tag => ref this.RefData(8); - - public bool IsSlot - { - get => Tag == 0; - set => Tag = 0; - } - - public uint Slot_Offset - { - get => IsSlot ? this.ReadDataUInt(32) : default; - set => this.WriteData(32, value); - } - - public Type.Writer Slot_Type - { - get => IsSlot ? BuildPointer(2) : default; - set => Link(2, value); - } - - public Value.Writer Slot_DefaultValue - { - get => IsSlot ? BuildPointer(3) : default; - set => Link(3, value); - } - - public bool Slot_HadExplicitDefault - { - get => IsSlot ? this.ReadDataBool(128) : default; - set => this.WriteData(128, value); - } - - public bool IsGroup - { - get => Tag == 1; - set => Tag = 1; - } - - public ref ulong Group_TypeId => ref this.RefData(2); - - public ref ushort Ordinal_Tag => ref this.RefData(5); - - public bool Ordinal_IsImplicit - { - get => Ordinal_Tag == 0; - set => Ordinal_Tag = 0; - } - - public bool Ordinal_IsExplicit - { - get => Ordinal_Tag == 1; - set => Ordinal_Tag = 1; - } - - public ref ushort Ordinal_Explicit => ref this.RefData(6); - } - } - - namespace Node - { - namespace Parameter - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public string Name => State.ReadText(0); - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(0, 1); - } - - public string Name - { - get => ReadText(0); - set => WriteText(0, value); - } - } - } - - namespace NestedNode - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public string Name => State.ReadText(0); - public ulong Id => State.ReadDataULong(0); - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(1, 1); - } - - public string Name - { - get => ReadText(0); - set => WriteText(0, value); - } - - public ref ulong Id => ref this.RefData(0); - } - } - - namespace SourceInfo - { - namespace Member - { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public string DocComment => State.ReadText(0); - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(0, 1); - } - - public string DocComment - { - get => ReadText(0); - set => WriteText(0, value); - } - } - } - - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ulong Id => State.ReadDataULong(0); - public string DocComment => State.ReadText(0); - public IReadOnlyList Members => State.ReadListOfStructs(1, Member.Reader.Create); - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(1, 2); - } - - public ref ulong Id => ref this.RefData(0); - - public string DocComment - { - get => ReadText(0); - set => WriteText(0, value); - } - - public ListOfStructsSerializer Members - { - get => BuildPointer>(1); - set => Link(1, value); - } - } - } - - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ulong Id => State.ReadDataULong(0); - public string DisplayName => State.ReadText(0); - public uint DisplayNamePrefixLength => State.ReadDataUInt(64); - public ulong ScopeId => State.ReadDataULong(128); - public IReadOnlyList Parameters => State.ReadListOfStructs(5, Parameter.Reader.Create); - public bool IsGeneric => State.ReadDataBool(288); - public IReadOnlyList NestedNodes => State.ReadListOfStructs(1, NestedNode.Reader.Create); - public IReadOnlyList Annotations => State.ReadListOfStructs(2, Annotation.Reader.Create); - public ushort Tag => State.ReadDataUShort(96); - public bool IsFile => Tag == 0; - public bool IsStruct => Tag == 1; - public ushort Struct_DataWordCount => IsStruct ? State.ReadDataUShort(112) : default; - public ushort Struct_PointerCount => IsStruct ? State.ReadDataUShort(192) : default; - public ElementSize Struct_PreferredListEncoding => IsStruct ? (ElementSize)State.ReadDataUShort(208) : default; - public bool Struct_IsGroup => IsStruct ? State.ReadDataBool(224) : default; - public ushort Struct_DiscriminantCount => IsStruct ? State.ReadDataUShort(240) : default; - public uint Struct_DiscriminantOffset => IsStruct ? State.ReadDataUInt(256) : default; - public IReadOnlyList Fields => IsStruct ? State.ReadListOfStructs(3, Field.Reader.Create) : default; - public bool IsEnum => Tag == 2; - public IReadOnlyList Enumerants => IsEnum ? State.ReadListOfStructs(3, Field.Reader.Create) : default; - public bool IsInterface => Tag == 3; - public IReadOnlyList Interface_Methods => IsInterface ? State.ReadListOfStructs(3, Method.Reader.Create) : default; - public IReadOnlyList Interface_Superclasses => IsInterface ? State.ReadListOfStructs(4, Superclass.Reader.Create) : default; - public bool IsConst => Tag == 4; - public Type.Reader Const_Type => IsConst ? State.ReadStruct(3, Type.Reader.Create) : default; - public Value.Reader Const_Value => IsConst ? State.ReadStruct(4, Value.Reader.Create) : default; - public bool IsAnnotation => Tag == 5; - public Type.Reader Annotation_Type => IsAnnotation ? State.ReadStruct(3, Type.Reader.Create) : default; - public bool Annotation_TargetsFile => IsAnnotation ? State.ReadDataBool(112) : default; - public bool Annotation_TargetsConst => IsAnnotation ? State.ReadDataBool(113) : default; - public bool Annotation_TargetsEnum => IsAnnotation ? State.ReadDataBool(114) : default; - public bool Annotation_TargetsEnumerant => IsAnnotation ? State.ReadDataBool(115) : default; - public bool Annotation_TargetsStruct => IsAnnotation ? State.ReadDataBool(116) : default; - public bool Annotation_TargetsField => IsAnnotation ? State.ReadDataBool(117) : default; - public bool Annotation_TargetsUnion => IsAnnotation ? State.ReadDataBool(118) : default; - public bool Annotation_TargetsGroup => IsAnnotation ? State.ReadDataBool(119) : default; - public bool Annotation_TargetsInterface => IsAnnotation ? State.ReadDataBool(120) : default; - public bool Annotation_TargetsMethod => IsAnnotation ? State.ReadDataBool(121) : default; - public bool Annotation_TargetsParam => IsAnnotation ? State.ReadDataBool(122) : default; - public bool Annotation_TargetsAnnotation => IsAnnotation ? State.ReadDataBool(123) : default; - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(5, 6); - } - - public ulong Id - { - get => this.ReadDataULong(0); - set => this.WriteData(0, value); + get => this.ReadDataULong(0UL, 0UL); + set => this.WriteData(0UL, value, 0UL); } public string DisplayName { - get => ReadText(0); - set => WriteText(0, value); + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); } - public ref uint DisplayNamePrefixLength => ref this.RefData(2); - - public ref ulong ScopeId => ref this.RefData(2); - - public ListOfStructsSerializer Parameters + public uint DisplayNamePrefixLength { - get => BuildPointer>(5); + get => this.ReadDataUInt(64UL, 0U); + set => this.WriteData(64UL, value, 0U); + } + + public ulong ScopeId + { + get => this.ReadDataULong(128UL, 0UL); + set => this.WriteData(128UL, value, 0UL); + } + + public ListOfStructsSerializer NestedNodes + { + get => BuildPointer>(1); + set => Link(1, value); + } + + public ListOfStructsSerializer Annotations + { + get => BuildPointer>(2); + set => Link(2, value); + } + + public @struct.WRITER Struct + { + get => which == WHICH.Struct ? Rewrap<@struct.WRITER>() : default; + } + + public @enum.WRITER Enum + { + get => which == WHICH.Enum ? Rewrap<@enum.WRITER>() : default; + } + + public @interface.WRITER Interface + { + get => which == WHICH.Interface ? Rewrap<@interface.WRITER>() : default; + } + + public @const.WRITER Const + { + get => which == WHICH.Const ? Rewrap<@const.WRITER>() : default; + } + + public annotation.WRITER Annotation + { + get => which == WHICH.Annotation ? Rewrap() : default; + } + + public ListOfStructsSerializer Parameters + { + get => BuildPointer>(5); set => Link(5, value); } public bool IsGeneric { - get => this.ReadDataBool(288); - set => this.WriteData(288, value); - } - - public ListOfStructsSerializer NestedNodes - { - get => BuildPointer>(1); - set => Link(1, value); - } - - public ListOfStructsSerializer Annotations - { - get => BuildPointer>(2); - set => Link(2, value); - } - - public ref ushort Tag => ref this.RefData(6); - - public bool IsFile - { - get => Tag == 0; - set => Tag = 0; - } - - public bool IsStruct - { - get => Tag == 1; - set => Tag = 1; - } - - public ref ushort Struct_DataWordCount => ref this.RefData(7); - - public ref ushort Struct_PointerCount => ref this.RefData(12); - - public ref ElementSize Struct_PreferredListEncoding => ref this.RefData(13); - - public bool Struct_IsGroup - { - get => IsStruct ? this.ReadDataBool(224) : default; - set => this.WriteData(224, value); - } - - public ref ushort Struct_DiscriminantCount => ref this.RefData(15); - - public ref uint Struct_DiscriminantOffset => ref this.RefData(8); - - public ListOfStructsSerializer Fields - { - get => BuildPointer>(3); - set => Link(3, value); - } - - public bool IsEnum - { - get => Tag == 2; - set => Tag = 2; - } - - public ListOfStructsSerializer Enumerants - { - get => BuildPointer>(3); - set => Link(3, value); - } - - public bool IsInterface - { - get => Tag == 3; - set => Tag = 3; - } - - public ListOfStructsSerializer Interface_Methods - { - get => BuildPointer>(3); - set => Link(3, value); - } - - public ListOfStructsSerializer Interface_Superclasses - { - get => IsInterface ? BuildPointer>(4) : default; - set => Link(4, value); - } - - public bool IsConst - { - get => Tag == 4; - set => Tag = 4; - } - - public Type.Writer Const_Type - { - get => IsConst ? BuildPointer(3) : default; - set => Link(3, value); - } - - public Value.Writer Const_Value - { - get => IsConst ? BuildPointer(4) : default; - set => Link(4, value); - } - - public bool IsAnnotation - { - get => Tag == 5; - set => Tag = 5; - } - - public Type.Writer Annotation_Type - { - get => IsAnnotation ? BuildPointer(3) : default; - set => Link(3, value); - } - - public bool Annotation_TargetsFile - { - get => IsAnnotation ? this.ReadDataBool(112) : default; - set => this.WriteData(112, value); - } - - public bool Annotation_TargetsConst - { - get => IsAnnotation ? this.ReadDataBool(113) : default; - set => this.WriteData(113, value); - } - - public bool Annotation_TargetsEnum - { - get => IsAnnotation ? this.ReadDataBool(114) : default; - set => this.WriteData(114, value); - } - - public bool Annotation_TargetsEnumerant - { - get => IsAnnotation ? this.ReadDataBool(115) : default; - set => this.WriteData(115, value); - } - - public bool Annotation_TargetsStruct - { - get => IsAnnotation ? this.ReadDataBool(116) : default; - set => this.WriteData(116, value); - } - - public bool Annotation_TargetsField - { - get => IsAnnotation ? this.ReadDataBool(117) : default; - set => this.WriteData(117, value); - } - - public bool Annotation_TargetsUnion - { - get => IsAnnotation ? this.ReadDataBool(118) : default; - set => this.WriteData(118, value); - } - - public bool Annotation_TargetsGroup - { - get => IsAnnotation ? this.ReadDataBool(119) : default; - set => this.WriteData(119, value); - } - - public bool Annotation_TargetsInterface - { - get => IsAnnotation ? this.ReadDataBool(120) : default; - set => this.WriteData(120, value); - } - - public bool Annotation_TargetsMethod - { - get => IsAnnotation ? this.ReadDataBool(121) : default; - set => this.WriteData(121, value); - } - - public bool Annotation_TargetsParam - { - get => IsAnnotation ? this.ReadDataBool(122) : default; - set => this.WriteData(122, value); - } - - public bool Annotation_TargetsAnnotation - { - get => IsAnnotation ? this.ReadDataBool(123) : default; - set => this.WriteData(123, value); + get => this.ReadDataBool(288UL, false); + set => this.WriteData(288UL, value, false); } } - } - namespace CapnpVersion - { - public struct Reader + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x9ea0b19b37fb4435UL)] + public class @struct : ICapnpSerializable { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) + public const UInt64 typeId = 0x9ea0b19b37fb4435UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) { - State = ctx; + var reader = READER.create(arg_); + DataWordCount = reader.DataWordCount; + PointerCount = reader.PointerCount; + PreferredListEncoding = reader.PreferredListEncoding; + IsGroup = reader.IsGroup; + DiscriminantCount = reader.DiscriminantCount; + DiscriminantOffset = reader.DiscriminantOffset; + Fields = reader.Fields?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); } - public static Reader Create(DeserializerState ctx) => new Reader(ctx); + public void serialize(WRITER writer) + { + writer.DataWordCount = DataWordCount; + writer.PointerCount = PointerCount; + writer.PreferredListEncoding = PreferredListEncoding; + writer.IsGroup = IsGroup; + writer.DiscriminantCount = DiscriminantCount; + writer.DiscriminantOffset = DiscriminantOffset; + writer.Fields.Init(Fields, (_s1, _v1) => _v1?.serialize(_s1)); + } - public ushort Major => State.ReadDataUShort(0); - public byte Minor => State.ReadDataByte(16); - public byte Micro => State.ReadDataByte(24); + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ushort DataWordCount + { + get; + set; + } + + public ushort PointerCount + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.ElementSize PreferredListEncoding + { + get; + set; + } + + public bool IsGroup + { + get; + set; + } + + public ushort DiscriminantCount + { + get; + set; + } + + public uint DiscriminantOffset + { + get; + set; + } + + public IReadOnlyList Fields + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ushort DataWordCount => ctx.ReadDataUShort(112UL, (ushort)0); + public ushort PointerCount => ctx.ReadDataUShort(192UL, (ushort)0); + public CapnpC.CSharp.Generator.Schema.ElementSize PreferredListEncoding => (CapnpC.CSharp.Generator.Schema.ElementSize)ctx.ReadDataUShort(208UL, (ushort)0); + public bool IsGroup => ctx.ReadDataBool(224UL, false); + public ushort DiscriminantCount => ctx.ReadDataUShort(240UL, (ushort)0); + public uint DiscriminantOffset => ctx.ReadDataUInt(256UL, 0U); + public IReadOnlyList Fields => ctx.ReadList(3).Cast(CapnpC.CSharp.Generator.Schema.Field.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public ushort DataWordCount + { + get => this.ReadDataUShort(112UL, (ushort)0); + set => this.WriteData(112UL, value, (ushort)0); + } + + public ushort PointerCount + { + get => this.ReadDataUShort(192UL, (ushort)0); + set => this.WriteData(192UL, value, (ushort)0); + } + + public CapnpC.CSharp.Generator.Schema.ElementSize PreferredListEncoding + { + get => (CapnpC.CSharp.Generator.Schema.ElementSize)this.ReadDataUShort(208UL, (ushort)0); + set => this.WriteData(208UL, (ushort)value, (ushort)0); + } + + public bool IsGroup + { + get => this.ReadDataBool(224UL, false); + set => this.WriteData(224UL, value, false); + } + + public ushort DiscriminantCount + { + get => this.ReadDataUShort(240UL, (ushort)0); + set => this.WriteData(240UL, value, (ushort)0); + } + + public uint DiscriminantOffset + { + get => this.ReadDataUInt(256UL, 0U); + set => this.WriteData(256UL, value, 0U); + } + + public ListOfStructsSerializer Fields + { + get => BuildPointer>(3); + set => Link(3, value); + } + } } - public class Writer: SerializerState + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xb54ab3364333f598UL)] + public class @enum : ICapnpSerializable { - public Writer() + public const UInt64 typeId = 0xb54ab3364333f598UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) { - SetStruct(1, 0); + var reader = READER.create(arg_); + Enumerants = reader.Enumerants?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); } - public ref ushort Major => ref this.RefData(0); - public ref byte Minor => ref this.RefData(2); - public ref byte Micro => ref this.RefData(3); + public void serialize(WRITER writer) + { + writer.Enumerants.Init(Enumerants, (_s1, _v1) => _v1?.serialize(_s1)); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public IReadOnlyList Enumerants + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public IReadOnlyList Enumerants => ctx.ReadList(3).Cast(CapnpC.CSharp.Generator.Schema.Enumerant.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public ListOfStructsSerializer Enumerants + { + get => BuildPointer>(3); + set => Link(3, value); + } + } } - } - namespace CodeGeneratorRequest - { - namespace RequestedFile + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xe82753cff0c2218fUL)] + public class @interface : ICapnpSerializable { - namespace Import + public const UInt64 typeId = 0xe82753cff0c2218fUL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) { - public struct Reader - { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ulong Id => State.ReadDataULong(0); - public string Name => State.ReadText(0); - } - - public class Writer: SerializerState - { - public Writer() - { - SetStruct(1, 1); - } - - public ref ulong Id => ref this.RefData(0); - - public string Name - { - get => ReadText(0); - set => WriteText(0, value); - } - } + var reader = READER.create(arg_); + Methods = reader.Methods?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + Superclasses = reader.Superclasses?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); } - public struct Reader + public void serialize(WRITER writer) { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) - { - State = ctx; - } - - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public ulong Id => State.ReadDataULong(0); - public string Filename => State.ReadText(0); - public IReadOnlyList Imports => State.ReadListOfStructs(1, Import.Reader.Create); + writer.Methods.Init(Methods, (_s1, _v1) => _v1?.serialize(_s1)); + writer.Superclasses.Init(Superclasses, (_s1, _v1) => _v1?.serialize(_s1)); } - public class Writer: SerializerState + void ICapnpSerializable.Serialize(SerializerState arg_) { - public Writer() + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public IReadOnlyList Methods + { + get; + set; + } + + public IReadOnlyList Superclasses + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) { - SetStruct(1, 2); + this.ctx = ctx; } - public ref ulong Id => ref this.RefData(0); + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public IReadOnlyList Methods => ctx.ReadList(3).Cast(CapnpC.CSharp.Generator.Schema.Method.READER.create); + public IReadOnlyList Superclasses => ctx.ReadList(4).Cast(CapnpC.CSharp.Generator.Schema.Superclass.READER.create); + } - public string Filename + public class WRITER : SerializerState + { + public WRITER() { - get => ReadText(0); - set => WriteText(0, value); } - public ListOfStructsSerializer Imports + public ListOfStructsSerializer Methods { - get => BuildPointer>(1); + get => BuildPointer>(3); + set => Link(3, value); + } + + public ListOfStructsSerializer Superclasses + { + get => BuildPointer>(4); + set => Link(4, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xb18aa5ac7a0d9420UL)] + public class @const : ICapnpSerializable + { + public const UInt64 typeId = 0xb18aa5ac7a0d9420UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Type = CapnpSerializable.Create(reader.Type); + Value = CapnpSerializable.Create(reader.Value); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + Type?.serialize(writer.Type); + Value?.serialize(writer.Value); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public CapnpC.CSharp.Generator.Schema.Type Type + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Value Value + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public CapnpC.CSharp.Generator.Schema.Type.READER Type => ctx.ReadStruct(3, CapnpC.CSharp.Generator.Schema.Type.READER.create); + public CapnpC.CSharp.Generator.Schema.Value.READER Value => ctx.ReadStruct(4, CapnpC.CSharp.Generator.Schema.Value.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public CapnpC.CSharp.Generator.Schema.Type.WRITER Type + { + get => BuildPointer(3); + set => Link(3, value); + } + + public CapnpC.CSharp.Generator.Schema.Value.WRITER Value + { + get => BuildPointer(4); + set => Link(4, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xec1619d4400a0290UL)] + public class annotation : ICapnpSerializable + { + public const UInt64 typeId = 0xec1619d4400a0290UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Type = CapnpSerializable.Create(reader.Type); + TargetsFile = reader.TargetsFile; + TargetsConst = reader.TargetsConst; + TargetsEnum = reader.TargetsEnum; + TargetsEnumerant = reader.TargetsEnumerant; + TargetsStruct = reader.TargetsStruct; + TargetsField = reader.TargetsField; + TargetsUnion = reader.TargetsUnion; + TargetsGroup = reader.TargetsGroup; + TargetsInterface = reader.TargetsInterface; + TargetsMethod = reader.TargetsMethod; + TargetsParam = reader.TargetsParam; + TargetsAnnotation = reader.TargetsAnnotation; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + Type?.serialize(writer.Type); + writer.TargetsFile = TargetsFile; + writer.TargetsConst = TargetsConst; + writer.TargetsEnum = TargetsEnum; + writer.TargetsEnumerant = TargetsEnumerant; + writer.TargetsStruct = TargetsStruct; + writer.TargetsField = TargetsField; + writer.TargetsUnion = TargetsUnion; + writer.TargetsGroup = TargetsGroup; + writer.TargetsInterface = TargetsInterface; + writer.TargetsMethod = TargetsMethod; + writer.TargetsParam = TargetsParam; + writer.TargetsAnnotation = TargetsAnnotation; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public CapnpC.CSharp.Generator.Schema.Type Type + { + get; + set; + } + + public bool TargetsFile + { + get; + set; + } + + public bool TargetsConst + { + get; + set; + } + + public bool TargetsEnum + { + get; + set; + } + + public bool TargetsEnumerant + { + get; + set; + } + + public bool TargetsStruct + { + get; + set; + } + + public bool TargetsField + { + get; + set; + } + + public bool TargetsUnion + { + get; + set; + } + + public bool TargetsGroup + { + get; + set; + } + + public bool TargetsInterface + { + get; + set; + } + + public bool TargetsMethod + { + get; + set; + } + + public bool TargetsParam + { + get; + set; + } + + public bool TargetsAnnotation + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public CapnpC.CSharp.Generator.Schema.Type.READER Type => ctx.ReadStruct(3, CapnpC.CSharp.Generator.Schema.Type.READER.create); + public bool TargetsFile => ctx.ReadDataBool(112UL, false); + public bool TargetsConst => ctx.ReadDataBool(113UL, false); + public bool TargetsEnum => ctx.ReadDataBool(114UL, false); + public bool TargetsEnumerant => ctx.ReadDataBool(115UL, false); + public bool TargetsStruct => ctx.ReadDataBool(116UL, false); + public bool TargetsField => ctx.ReadDataBool(117UL, false); + public bool TargetsUnion => ctx.ReadDataBool(118UL, false); + public bool TargetsGroup => ctx.ReadDataBool(119UL, false); + public bool TargetsInterface => ctx.ReadDataBool(120UL, false); + public bool TargetsMethod => ctx.ReadDataBool(121UL, false); + public bool TargetsParam => ctx.ReadDataBool(122UL, false); + public bool TargetsAnnotation => ctx.ReadDataBool(123UL, false); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public CapnpC.CSharp.Generator.Schema.Type.WRITER Type + { + get => BuildPointer(3); + set => Link(3, value); + } + + public bool TargetsFile + { + get => this.ReadDataBool(112UL, false); + set => this.WriteData(112UL, value, false); + } + + public bool TargetsConst + { + get => this.ReadDataBool(113UL, false); + set => this.WriteData(113UL, value, false); + } + + public bool TargetsEnum + { + get => this.ReadDataBool(114UL, false); + set => this.WriteData(114UL, value, false); + } + + public bool TargetsEnumerant + { + get => this.ReadDataBool(115UL, false); + set => this.WriteData(115UL, value, false); + } + + public bool TargetsStruct + { + get => this.ReadDataBool(116UL, false); + set => this.WriteData(116UL, value, false); + } + + public bool TargetsField + { + get => this.ReadDataBool(117UL, false); + set => this.WriteData(117UL, value, false); + } + + public bool TargetsUnion + { + get => this.ReadDataBool(118UL, false); + set => this.WriteData(118UL, value, false); + } + + public bool TargetsGroup + { + get => this.ReadDataBool(119UL, false); + set => this.WriteData(119UL, value, false); + } + + public bool TargetsInterface + { + get => this.ReadDataBool(120UL, false); + set => this.WriteData(120UL, value, false); + } + + public bool TargetsMethod + { + get => this.ReadDataBool(121UL, false); + set => this.WriteData(121UL, value, false); + } + + public bool TargetsParam + { + get => this.ReadDataBool(122UL, false); + set => this.WriteData(122UL, value, false); + } + + public bool TargetsAnnotation + { + get => this.ReadDataBool(123UL, false); + set => this.WriteData(123UL, value, false); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xb9521bccf10fa3b1UL)] + public class Parameter : ICapnpSerializable + { + public const UInt64 typeId = 0xb9521bccf10fa3b1UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Name = reader.Name; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Name = Name; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public string Name + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public string Name => ctx.ReadText(0, null); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(0, 1); + } + + public string Name + { + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xdebf55bbfa0fc242UL)] + public class NestedNode : ICapnpSerializable + { + public const UInt64 typeId = 0xdebf55bbfa0fc242UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Name = reader.Name; + Id = reader.Id; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Name = Name; + writer.Id = Id; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public string Name + { + get; + set; + } + + public ulong Id + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public string Name => ctx.ReadText(0, null); + public ulong Id => ctx.ReadDataULong(0UL, 0UL); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 1); + } + + public string Name + { + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + + public ulong Id + { + get => this.ReadDataULong(0UL, 0UL); + set => this.WriteData(0UL, value, 0UL); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xf38e1de3041357aeUL)] + public class SourceInfo : ICapnpSerializable + { + public const UInt64 typeId = 0xf38e1de3041357aeUL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Id = reader.Id; + DocComment = reader.DocComment; + Members = reader.Members?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Id = Id; + writer.DocComment = DocComment; + writer.Members.Init(Members, (_s1, _v1) => _v1?.serialize(_s1)); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong Id + { + get; + set; + } + + public string DocComment + { + get; + set; + } + + public IReadOnlyList Members + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong Id => ctx.ReadDataULong(0UL, 0UL); + public string DocComment => ctx.ReadText(0, null); + public IReadOnlyList Members => ctx.ReadList(1).Cast(CapnpC.CSharp.Generator.Schema.Node.SourceInfo.Member.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 2); + } + + public ulong Id + { + get => this.ReadDataULong(0UL, 0UL); + set => this.WriteData(0UL, value, 0UL); + } + + public string DocComment + { + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + + public ListOfStructsSerializer Members + { + get => BuildPointer>(1); set => Link(1, value); } } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xc2ba9038898e1fa2UL)] + public class Member : ICapnpSerializable + { + public const UInt64 typeId = 0xc2ba9038898e1fa2UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + DocComment = reader.DocComment; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.DocComment = DocComment; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public string DocComment + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public string DocComment => ctx.ReadText(0, null); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(0, 1); + } + + public string DocComment + { + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + } + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x9aad50a41f4af45fUL)] + public class Field : ICapnpSerializable + { + public const UInt64 typeId = 0x9aad50a41f4af45fUL; + public enum WHICH : ushort + { + Slot = 0, + Group = 1, + undefined = 65535 } - public struct Reader + void ICapnpSerializable.Deserialize(DeserializerState arg_) { - public DeserializerState State { get; } - - public Reader(DeserializerState ctx) + var reader = READER.create(arg_); + switch (reader.which) { - State = ctx; + case WHICH.Slot: + Slot = CapnpSerializable.Create(reader.Slot); + break; + case WHICH.Group: + Group = CapnpSerializable.Create(reader.Group); + break; } - public static Reader Create(DeserializerState ctx) => new Reader(ctx); - - public CapnpVersion.Reader CapnpVersion => State.ReadStruct(2, Schema.CapnpVersion.Reader.Create); - public IReadOnlyList Nodes => State.ReadListOfStructs(0, Node.Reader.Create); - public IReadOnlyList SourceInfo => State.ReadListOfStructs(3, Node.SourceInfo.Reader.Create); - public IReadOnlyList RequestedFiles => State.ReadListOfStructs(1, RequestedFile.Reader.Create); + Name = reader.Name; + CodeOrder = reader.CodeOrder; + Annotations = reader.Annotations?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + DiscriminantValue = reader.DiscriminantValue; + Ordinal = CapnpSerializable.Create(reader.Ordinal); + applyDefaults(); } - public class Writer: SerializerState + private WHICH _which = WHICH.undefined; + private object _content; + public WHICH which { - public Writer() + get => _which; + set { - SetStruct(0, 3); + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.Slot: + _content = null; + break; + case WHICH.Group: + _content = null; + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.Slot: + Slot?.serialize(writer.Slot); + break; + case WHICH.Group: + Group?.serialize(writer.Group); + break; } - public CapnpVersion.Writer CapnpVersion + writer.Name = Name; + writer.CodeOrder = CodeOrder; + writer.Annotations.Init(Annotations, (_s1, _v1) => _v1?.serialize(_s1)); + writer.DiscriminantValue = DiscriminantValue; + Ordinal?.serialize(writer.Ordinal); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public string Name + { + get; + set; + } + + public ushort CodeOrder + { + get; + set; + } + + public IReadOnlyList Annotations + { + get; + set; + } + + public ushort DiscriminantValue + { + get; + set; + } + + = 65535; + public CapnpC.CSharp.Generator.Schema.Field.slot Slot + { + get => _which == WHICH.Slot ? (CapnpC.CSharp.Generator.Schema.Field.slot)_content : null; + set { - get => BuildPointer(2); - set => Link(2, value); + _which = WHICH.Slot; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Field.@group Group + { + get => _which == WHICH.Group ? (CapnpC.CSharp.Generator.Schema.Field.@group)_content : null; + set + { + _which = WHICH.Group; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Field.ordinal Ordinal + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; } - public ListOfStructsSerializer Nodes + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(64U, (ushort)0); + public string Name => ctx.ReadText(0, null); + public ushort CodeOrder => ctx.ReadDataUShort(0UL, (ushort)0); + public IReadOnlyList Annotations => ctx.ReadList(1).Cast(CapnpC.CSharp.Generator.Schema.Annotation.READER.create); + public ushort DiscriminantValue => ctx.ReadDataUShort(16UL, (ushort)65535); + public slot.READER Slot => which == WHICH.Slot ? new slot.READER(ctx) : default; + public @group.READER Group => which == WHICH.Group ? new @group.READER(ctx) : default; + public ordinal.READER Ordinal => new ordinal.READER(ctx); + } + + public class WRITER : SerializerState + { + public WRITER() { - get => BuildPointer>(0); - set => Link(0, value); + this.SetStruct(3, 4); } - public ListOfStructsSerializer SourceInfo + public WHICH which { - get => BuildPointer>(3); - set => Link(3, value); + get => (WHICH)this.ReadDataUShort(64U, (ushort)0); + set => this.WriteData(64U, (ushort)value, (ushort)0); } - public ListOfStructsSerializer RequestedFiles + public string Name { - get => BuildPointer>(1); + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + + public ushort CodeOrder + { + get => this.ReadDataUShort(0UL, (ushort)0); + set => this.WriteData(0UL, value, (ushort)0); + } + + public ListOfStructsSerializer Annotations + { + get => BuildPointer>(1); + set => Link(1, value); + } + + public ushort DiscriminantValue + { + get => this.ReadDataUShort(16UL, (ushort)65535); + set => this.WriteData(16UL, value, (ushort)65535); + } + + public slot.WRITER Slot + { + get => which == WHICH.Slot ? Rewrap() : default; + } + + public @group.WRITER Group + { + get => which == WHICH.Group ? Rewrap<@group.WRITER>() : default; + } + + public ordinal.WRITER Ordinal + { + get => Rewrap(); + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xc42305476bb4746fUL)] + public class slot : ICapnpSerializable + { + public const UInt64 typeId = 0xc42305476bb4746fUL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Offset = reader.Offset; + Type = CapnpSerializable.Create(reader.Type); + DefaultValue = CapnpSerializable.Create(reader.DefaultValue); + HadExplicitDefault = reader.HadExplicitDefault; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Offset = Offset; + Type?.serialize(writer.Type); + DefaultValue?.serialize(writer.DefaultValue); + writer.HadExplicitDefault = HadExplicitDefault; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public uint Offset + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Type Type + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Value DefaultValue + { + get; + set; + } + + public bool HadExplicitDefault + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public uint Offset => ctx.ReadDataUInt(32UL, 0U); + public CapnpC.CSharp.Generator.Schema.Type.READER Type => ctx.ReadStruct(2, CapnpC.CSharp.Generator.Schema.Type.READER.create); + public CapnpC.CSharp.Generator.Schema.Value.READER DefaultValue => ctx.ReadStruct(3, CapnpC.CSharp.Generator.Schema.Value.READER.create); + public bool HadExplicitDefault => ctx.ReadDataBool(128UL, false); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public uint Offset + { + get => this.ReadDataUInt(32UL, 0U); + set => this.WriteData(32UL, value, 0U); + } + + public CapnpC.CSharp.Generator.Schema.Type.WRITER Type + { + get => BuildPointer(2); + set => Link(2, value); + } + + public CapnpC.CSharp.Generator.Schema.Value.WRITER DefaultValue + { + get => BuildPointer(3); + set => Link(3, value); + } + + public bool HadExplicitDefault + { + get => this.ReadDataBool(128UL, false); + set => this.WriteData(128UL, value, false); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xcafccddb68db1d11UL)] + public class @group : ICapnpSerializable + { + public const UInt64 typeId = 0xcafccddb68db1d11UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + TypeId = reader.TypeId; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.TypeId = TypeId; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong TypeId + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong TypeId => ctx.ReadDataULong(128UL, 0UL); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public ulong TypeId + { + get => this.ReadDataULong(128UL, 0UL); + set => this.WriteData(128UL, value, 0UL); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xbb90d5c287870be6UL)] + public class ordinal : ICapnpSerializable + { + public const UInt64 typeId = 0xbb90d5c287870be6UL; + public enum WHICH : ushort + { + Implicit = 0, + Explicit = 1, + undefined = 65535 + } + + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + switch (reader.which) + { + case WHICH.Implicit: + which = reader.which; + break; + case WHICH.Explicit: + Explicit = reader.Explicit; + break; + } + + applyDefaults(); + } + + private WHICH _which = WHICH.undefined; + private object _content; + public WHICH which + { + get => _which; + set + { + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.Implicit: + break; + case WHICH.Explicit: + _content = 0; + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.Implicit: + break; + case WHICH.Explicit: + writer.Explicit = Explicit.Value; + break; + } + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ushort? Explicit + { + get => _which == WHICH.Explicit ? (ushort?)_content : null; + set + { + _which = WHICH.Explicit; + _content = value; + } + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(80U, (ushort)0); + public ushort Explicit => which == WHICH.Explicit ? ctx.ReadDataUShort(96UL, (ushort)0) : default; + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public WHICH which + { + get => (WHICH)this.ReadDataUShort(80U, (ushort)0); + set => this.WriteData(80U, (ushort)value, (ushort)0); + } + + public ushort Explicit + { + get => which == WHICH.Explicit ? this.ReadDataUShort(96UL, (ushort)0) : default; + set => this.WriteData(96UL, value, (ushort)0); + } + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x978a7cebdc549a4dUL)] + public class Enumerant : ICapnpSerializable + { + public const UInt64 typeId = 0x978a7cebdc549a4dUL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Name = reader.Name; + CodeOrder = reader.CodeOrder; + Annotations = reader.Annotations?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Name = Name; + writer.CodeOrder = CodeOrder; + writer.Annotations.Init(Annotations, (_s1, _v1) => _v1?.serialize(_s1)); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public string Name + { + get; + set; + } + + public ushort CodeOrder + { + get; + set; + } + + public IReadOnlyList Annotations + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public string Name => ctx.ReadText(0, null); + public ushort CodeOrder => ctx.ReadDataUShort(0UL, (ushort)0); + public IReadOnlyList Annotations => ctx.ReadList(1).Cast(CapnpC.CSharp.Generator.Schema.Annotation.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 2); + } + + public string Name + { + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + + public ushort CodeOrder + { + get => this.ReadDataUShort(0UL, (ushort)0); + set => this.WriteData(0UL, value, (ushort)0); + } + + public ListOfStructsSerializer Annotations + { + get => BuildPointer>(1); set => Link(1, value); } } } -} + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xa9962a9ed0a4d7f8UL)] + public class Superclass : ICapnpSerializable + { + public const UInt64 typeId = 0xa9962a9ed0a4d7f8UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Id = reader.Id; + Brand = CapnpSerializable.Create(reader.Brand); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Id = Id; + Brand?.serialize(writer.Brand); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong Id + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Brand Brand + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong Id => ctx.ReadDataULong(0UL, 0UL); + public CapnpC.CSharp.Generator.Schema.Brand.READER Brand => ctx.ReadStruct(0, CapnpC.CSharp.Generator.Schema.Brand.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 1); + } + + public ulong Id + { + get => this.ReadDataULong(0UL, 0UL); + set => this.WriteData(0UL, value, 0UL); + } + + public CapnpC.CSharp.Generator.Schema.Brand.WRITER Brand + { + get => BuildPointer(0); + set => Link(0, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x9500cce23b334d80UL)] + public class Method : ICapnpSerializable + { + public const UInt64 typeId = 0x9500cce23b334d80UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Name = reader.Name; + CodeOrder = reader.CodeOrder; + ParamStructType = reader.ParamStructType; + ResultStructType = reader.ResultStructType; + Annotations = reader.Annotations?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + ParamBrand = CapnpSerializable.Create(reader.ParamBrand); + ResultBrand = CapnpSerializable.Create(reader.ResultBrand); + ImplicitParameters = reader.ImplicitParameters?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Name = Name; + writer.CodeOrder = CodeOrder; + writer.ParamStructType = ParamStructType; + writer.ResultStructType = ResultStructType; + writer.Annotations.Init(Annotations, (_s1, _v1) => _v1?.serialize(_s1)); + ParamBrand?.serialize(writer.ParamBrand); + ResultBrand?.serialize(writer.ResultBrand); + writer.ImplicitParameters.Init(ImplicitParameters, (_s1, _v1) => _v1?.serialize(_s1)); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public string Name + { + get; + set; + } + + public ushort CodeOrder + { + get; + set; + } + + public ulong ParamStructType + { + get; + set; + } + + public ulong ResultStructType + { + get; + set; + } + + public IReadOnlyList Annotations + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Brand ParamBrand + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Brand ResultBrand + { + get; + set; + } + + public IReadOnlyList ImplicitParameters + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public string Name => ctx.ReadText(0, null); + public ushort CodeOrder => ctx.ReadDataUShort(0UL, (ushort)0); + public ulong ParamStructType => ctx.ReadDataULong(64UL, 0UL); + public ulong ResultStructType => ctx.ReadDataULong(128UL, 0UL); + public IReadOnlyList Annotations => ctx.ReadList(1).Cast(CapnpC.CSharp.Generator.Schema.Annotation.READER.create); + public CapnpC.CSharp.Generator.Schema.Brand.READER ParamBrand => ctx.ReadStruct(2, CapnpC.CSharp.Generator.Schema.Brand.READER.create); + public CapnpC.CSharp.Generator.Schema.Brand.READER ResultBrand => ctx.ReadStruct(3, CapnpC.CSharp.Generator.Schema.Brand.READER.create); + public IReadOnlyList ImplicitParameters => ctx.ReadList(4).Cast(CapnpC.CSharp.Generator.Schema.Node.Parameter.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(3, 5); + } + + public string Name + { + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + + public ushort CodeOrder + { + get => this.ReadDataUShort(0UL, (ushort)0); + set => this.WriteData(0UL, value, (ushort)0); + } + + public ulong ParamStructType + { + get => this.ReadDataULong(64UL, 0UL); + set => this.WriteData(64UL, value, 0UL); + } + + public ulong ResultStructType + { + get => this.ReadDataULong(128UL, 0UL); + set => this.WriteData(128UL, value, 0UL); + } + + public ListOfStructsSerializer Annotations + { + get => BuildPointer>(1); + set => Link(1, value); + } + + public CapnpC.CSharp.Generator.Schema.Brand.WRITER ParamBrand + { + get => BuildPointer(2); + set => Link(2, value); + } + + public CapnpC.CSharp.Generator.Schema.Brand.WRITER ResultBrand + { + get => BuildPointer(3); + set => Link(3, value); + } + + public ListOfStructsSerializer ImplicitParameters + { + get => BuildPointer>(4); + set => Link(4, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xd07378ede1f9cc60UL)] + public class Type : ICapnpSerializable + { + public const UInt64 typeId = 0xd07378ede1f9cc60UL; + public enum WHICH : ushort + { + Void = 0, + Bool = 1, + Int8 = 2, + Int16 = 3, + Int32 = 4, + Int64 = 5, + Uint8 = 6, + Uint16 = 7, + Uint32 = 8, + Uint64 = 9, + Float32 = 10, + Float64 = 11, + Text = 12, + Data = 13, + List = 14, + Enum = 15, + Struct = 16, + Interface = 17, + AnyPointer = 18, + undefined = 65535 + } + + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + switch (reader.which) + { + case WHICH.Void: + which = reader.which; + break; + case WHICH.Bool: + which = reader.which; + break; + case WHICH.Int8: + which = reader.which; + break; + case WHICH.Int16: + which = reader.which; + break; + case WHICH.Int32: + which = reader.which; + break; + case WHICH.Int64: + which = reader.which; + break; + case WHICH.Uint8: + which = reader.which; + break; + case WHICH.Uint16: + which = reader.which; + break; + case WHICH.Uint32: + which = reader.which; + break; + case WHICH.Uint64: + which = reader.which; + break; + case WHICH.Float32: + which = reader.which; + break; + case WHICH.Float64: + which = reader.which; + break; + case WHICH.Text: + which = reader.which; + break; + case WHICH.Data: + which = reader.which; + break; + case WHICH.List: + List = CapnpSerializable.Create(reader.List); + break; + case WHICH.Enum: + Enum = CapnpSerializable.Create(reader.Enum); + break; + case WHICH.Struct: + Struct = CapnpSerializable.Create(reader.Struct); + break; + case WHICH.Interface: + Interface = CapnpSerializable.Create(reader.Interface); + break; + case WHICH.AnyPointer: + AnyPointer = CapnpSerializable.Create(reader.AnyPointer); + break; + } + + applyDefaults(); + } + + private WHICH _which = WHICH.undefined; + private object _content; + public WHICH which + { + get => _which; + set + { + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.Void: + break; + case WHICH.Bool: + break; + case WHICH.Int8: + break; + case WHICH.Int16: + break; + case WHICH.Int32: + break; + case WHICH.Int64: + break; + case WHICH.Uint8: + break; + case WHICH.Uint16: + break; + case WHICH.Uint32: + break; + case WHICH.Uint64: + break; + case WHICH.Float32: + break; + case WHICH.Float64: + break; + case WHICH.Text: + break; + case WHICH.Data: + break; + case WHICH.List: + _content = null; + break; + case WHICH.Enum: + _content = null; + break; + case WHICH.Struct: + _content = null; + break; + case WHICH.Interface: + _content = null; + break; + case WHICH.AnyPointer: + _content = null; + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.Void: + break; + case WHICH.Bool: + break; + case WHICH.Int8: + break; + case WHICH.Int16: + break; + case WHICH.Int32: + break; + case WHICH.Int64: + break; + case WHICH.Uint8: + break; + case WHICH.Uint16: + break; + case WHICH.Uint32: + break; + case WHICH.Uint64: + break; + case WHICH.Float32: + break; + case WHICH.Float64: + break; + case WHICH.Text: + break; + case WHICH.Data: + break; + case WHICH.List: + List?.serialize(writer.List); + break; + case WHICH.Enum: + Enum?.serialize(writer.Enum); + break; + case WHICH.Struct: + Struct?.serialize(writer.Struct); + break; + case WHICH.Interface: + Interface?.serialize(writer.Interface); + break; + case WHICH.AnyPointer: + AnyPointer?.serialize(writer.AnyPointer); + break; + } + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public CapnpC.CSharp.Generator.Schema.Type.list List + { + get => _which == WHICH.List ? (CapnpC.CSharp.Generator.Schema.Type.list)_content : null; + set + { + _which = WHICH.List; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Type.@enum Enum + { + get => _which == WHICH.Enum ? (CapnpC.CSharp.Generator.Schema.Type.@enum)_content : null; + set + { + _which = WHICH.Enum; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Type.@struct Struct + { + get => _which == WHICH.Struct ? (CapnpC.CSharp.Generator.Schema.Type.@struct)_content : null; + set + { + _which = WHICH.Struct; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Type.@interface Interface + { + get => _which == WHICH.Interface ? (CapnpC.CSharp.Generator.Schema.Type.@interface)_content : null; + set + { + _which = WHICH.Interface; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Type.anyPointer AnyPointer + { + get => _which == WHICH.AnyPointer ? (CapnpC.CSharp.Generator.Schema.Type.anyPointer)_content : null; + set + { + _which = WHICH.AnyPointer; + _content = value; + } + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(0U, (ushort)0); + public list.READER List => which == WHICH.List ? new list.READER(ctx) : default; + public @enum.READER Enum => which == WHICH.Enum ? new @enum.READER(ctx) : default; + public @struct.READER Struct => which == WHICH.Struct ? new @struct.READER(ctx) : default; + public @interface.READER Interface => which == WHICH.Interface ? new @interface.READER(ctx) : default; + public anyPointer.READER AnyPointer => which == WHICH.AnyPointer ? new anyPointer.READER(ctx) : default; + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(3, 1); + } + + public WHICH which + { + get => (WHICH)this.ReadDataUShort(0U, (ushort)0); + set => this.WriteData(0U, (ushort)value, (ushort)0); + } + + public list.WRITER List + { + get => which == WHICH.List ? Rewrap() : default; + } + + public @enum.WRITER Enum + { + get => which == WHICH.Enum ? Rewrap<@enum.WRITER>() : default; + } + + public @struct.WRITER Struct + { + get => which == WHICH.Struct ? Rewrap<@struct.WRITER>() : default; + } + + public @interface.WRITER Interface + { + get => which == WHICH.Interface ? Rewrap<@interface.WRITER>() : default; + } + + public anyPointer.WRITER AnyPointer + { + get => which == WHICH.AnyPointer ? Rewrap() : default; + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x87e739250a60ea97UL)] + public class list : ICapnpSerializable + { + public const UInt64 typeId = 0x87e739250a60ea97UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + ElementType = CapnpSerializable.Create(reader.ElementType); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + ElementType?.serialize(writer.ElementType); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public CapnpC.CSharp.Generator.Schema.Type ElementType + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public CapnpC.CSharp.Generator.Schema.Type.READER ElementType => ctx.ReadStruct(0, CapnpC.CSharp.Generator.Schema.Type.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public CapnpC.CSharp.Generator.Schema.Type.WRITER ElementType + { + get => BuildPointer(0); + set => Link(0, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x9e0e78711a7f87a9UL)] + public class @enum : ICapnpSerializable + { + public const UInt64 typeId = 0x9e0e78711a7f87a9UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + TypeId = reader.TypeId; + Brand = CapnpSerializable.Create(reader.Brand); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.TypeId = TypeId; + Brand?.serialize(writer.Brand); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong TypeId + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Brand Brand + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong TypeId => ctx.ReadDataULong(64UL, 0UL); + public CapnpC.CSharp.Generator.Schema.Brand.READER Brand => ctx.ReadStruct(0, CapnpC.CSharp.Generator.Schema.Brand.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public ulong TypeId + { + get => this.ReadDataULong(64UL, 0UL); + set => this.WriteData(64UL, value, 0UL); + } + + public CapnpC.CSharp.Generator.Schema.Brand.WRITER Brand + { + get => BuildPointer(0); + set => Link(0, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xac3a6f60ef4cc6d3UL)] + public class @struct : ICapnpSerializable + { + public const UInt64 typeId = 0xac3a6f60ef4cc6d3UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + TypeId = reader.TypeId; + Brand = CapnpSerializable.Create(reader.Brand); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.TypeId = TypeId; + Brand?.serialize(writer.Brand); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong TypeId + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Brand Brand + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong TypeId => ctx.ReadDataULong(64UL, 0UL); + public CapnpC.CSharp.Generator.Schema.Brand.READER Brand => ctx.ReadStruct(0, CapnpC.CSharp.Generator.Schema.Brand.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public ulong TypeId + { + get => this.ReadDataULong(64UL, 0UL); + set => this.WriteData(64UL, value, 0UL); + } + + public CapnpC.CSharp.Generator.Schema.Brand.WRITER Brand + { + get => BuildPointer(0); + set => Link(0, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xed8bca69f7fb0cbfUL)] + public class @interface : ICapnpSerializable + { + public const UInt64 typeId = 0xed8bca69f7fb0cbfUL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + TypeId = reader.TypeId; + Brand = CapnpSerializable.Create(reader.Brand); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.TypeId = TypeId; + Brand?.serialize(writer.Brand); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong TypeId + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Brand Brand + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong TypeId => ctx.ReadDataULong(64UL, 0UL); + public CapnpC.CSharp.Generator.Schema.Brand.READER Brand => ctx.ReadStruct(0, CapnpC.CSharp.Generator.Schema.Brand.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public ulong TypeId + { + get => this.ReadDataULong(64UL, 0UL); + set => this.WriteData(64UL, value, 0UL); + } + + public CapnpC.CSharp.Generator.Schema.Brand.WRITER Brand + { + get => BuildPointer(0); + set => Link(0, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xc2573fe8a23e49f1UL)] + public class anyPointer : ICapnpSerializable + { + public const UInt64 typeId = 0xc2573fe8a23e49f1UL; + public enum WHICH : ushort + { + Unconstrained = 0, + Parameter = 1, + ImplicitMethodParameter = 2, + undefined = 65535 + } + + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + switch (reader.which) + { + case WHICH.Unconstrained: + Unconstrained = CapnpSerializable.Create(reader.Unconstrained); + break; + case WHICH.Parameter: + Parameter = CapnpSerializable.Create(reader.Parameter); + break; + case WHICH.ImplicitMethodParameter: + ImplicitMethodParameter = CapnpSerializable.Create(reader.ImplicitMethodParameter); + break; + } + + applyDefaults(); + } + + private WHICH _which = WHICH.undefined; + private object _content; + public WHICH which + { + get => _which; + set + { + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.Unconstrained: + _content = null; + break; + case WHICH.Parameter: + _content = null; + break; + case WHICH.ImplicitMethodParameter: + _content = null; + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.Unconstrained: + Unconstrained?.serialize(writer.Unconstrained); + break; + case WHICH.Parameter: + Parameter?.serialize(writer.Parameter); + break; + case WHICH.ImplicitMethodParameter: + ImplicitMethodParameter?.serialize(writer.ImplicitMethodParameter); + break; + } + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public CapnpC.CSharp.Generator.Schema.Type.anyPointer.unconstrained Unconstrained + { + get => _which == WHICH.Unconstrained ? (CapnpC.CSharp.Generator.Schema.Type.anyPointer.unconstrained)_content : null; + set + { + _which = WHICH.Unconstrained; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Type.anyPointer.parameter Parameter + { + get => _which == WHICH.Parameter ? (CapnpC.CSharp.Generator.Schema.Type.anyPointer.parameter)_content : null; + set + { + _which = WHICH.Parameter; + _content = value; + } + } + + public CapnpC.CSharp.Generator.Schema.Type.anyPointer.implicitMethodParameter ImplicitMethodParameter + { + get => _which == WHICH.ImplicitMethodParameter ? (CapnpC.CSharp.Generator.Schema.Type.anyPointer.implicitMethodParameter)_content : null; + set + { + _which = WHICH.ImplicitMethodParameter; + _content = value; + } + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(64U, (ushort)0); + public unconstrained.READER Unconstrained => which == WHICH.Unconstrained ? new unconstrained.READER(ctx) : default; + public parameter.READER Parameter => which == WHICH.Parameter ? new parameter.READER(ctx) : default; + public implicitMethodParameter.READER ImplicitMethodParameter => which == WHICH.ImplicitMethodParameter ? new implicitMethodParameter.READER(ctx) : default; + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public WHICH which + { + get => (WHICH)this.ReadDataUShort(64U, (ushort)0); + set => this.WriteData(64U, (ushort)value, (ushort)0); + } + + public unconstrained.WRITER Unconstrained + { + get => which == WHICH.Unconstrained ? Rewrap() : default; + } + + public parameter.WRITER Parameter + { + get => which == WHICH.Parameter ? Rewrap() : default; + } + + public implicitMethodParameter.WRITER ImplicitMethodParameter + { + get => which == WHICH.ImplicitMethodParameter ? Rewrap() : default; + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x8e3b5f79fe593656UL)] + public class unconstrained : ICapnpSerializable + { + public const UInt64 typeId = 0x8e3b5f79fe593656UL; + public enum WHICH : ushort + { + AnyKind = 0, + Struct = 1, + List = 2, + Capability = 3, + undefined = 65535 + } + + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + switch (reader.which) + { + case WHICH.AnyKind: + which = reader.which; + break; + case WHICH.Struct: + which = reader.which; + break; + case WHICH.List: + which = reader.which; + break; + case WHICH.Capability: + which = reader.which; + break; + } + + applyDefaults(); + } + + private WHICH _which = WHICH.undefined; + public WHICH which + { + get => _which; + set + { + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.AnyKind: + break; + case WHICH.Struct: + break; + case WHICH.List: + break; + case WHICH.Capability: + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.AnyKind: + break; + case WHICH.Struct: + break; + case WHICH.List: + break; + case WHICH.Capability: + break; + } + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(80U, (ushort)0); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public WHICH which + { + get => (WHICH)this.ReadDataUShort(80U, (ushort)0); + set => this.WriteData(80U, (ushort)value, (ushort)0); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x9dd1f724f4614a85UL)] + public class parameter : ICapnpSerializable + { + public const UInt64 typeId = 0x9dd1f724f4614a85UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + ScopeId = reader.ScopeId; + ParameterIndex = reader.ParameterIndex; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.ScopeId = ScopeId; + writer.ParameterIndex = ParameterIndex; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong ScopeId + { + get; + set; + } + + public ushort ParameterIndex + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong ScopeId => ctx.ReadDataULong(128UL, 0UL); + public ushort ParameterIndex => ctx.ReadDataUShort(80UL, (ushort)0); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public ulong ScopeId + { + get => this.ReadDataULong(128UL, 0UL); + set => this.WriteData(128UL, value, 0UL); + } + + public ushort ParameterIndex + { + get => this.ReadDataUShort(80UL, (ushort)0); + set => this.WriteData(80UL, value, (ushort)0); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xbaefc9120c56e274UL)] + public class implicitMethodParameter : ICapnpSerializable + { + public const UInt64 typeId = 0xbaefc9120c56e274UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + ParameterIndex = reader.ParameterIndex; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.ParameterIndex = ParameterIndex; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ushort ParameterIndex + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ushort ParameterIndex => ctx.ReadDataUShort(80UL, (ushort)0); + } + + public class WRITER : SerializerState + { + public WRITER() + { + } + + public ushort ParameterIndex + { + get => this.ReadDataUShort(80UL, (ushort)0); + set => this.WriteData(80UL, value, (ushort)0); + } + } + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0x903455f06065422bUL)] + public class Brand : ICapnpSerializable + { + public const UInt64 typeId = 0x903455f06065422bUL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Scopes = reader.Scopes?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Scopes.Init(Scopes, (_s1, _v1) => _v1?.serialize(_s1)); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public IReadOnlyList Scopes + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public IReadOnlyList Scopes => ctx.ReadList(0).Cast(CapnpC.CSharp.Generator.Schema.Brand.Scope.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(0, 1); + } + + public ListOfStructsSerializer Scopes + { + get => BuildPointer>(0); + set => Link(0, value); + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xabd73485a9636bc9UL)] + public class Scope : ICapnpSerializable + { + public const UInt64 typeId = 0xabd73485a9636bc9UL; + public enum WHICH : ushort + { + Bind = 0, + Inherit = 1, + undefined = 65535 + } + + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + switch (reader.which) + { + case WHICH.Bind: + Bind = reader.Bind?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + break; + case WHICH.Inherit: + which = reader.which; + break; + } + + ScopeId = reader.ScopeId; + applyDefaults(); + } + + private WHICH _which = WHICH.undefined; + private object _content; + public WHICH which + { + get => _which; + set + { + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.Bind: + _content = null; + break; + case WHICH.Inherit: + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.Bind: + writer.Bind.Init(Bind, (_s1, _v1) => _v1?.serialize(_s1)); + break; + case WHICH.Inherit: + break; + } + + writer.ScopeId = ScopeId; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong ScopeId + { + get; + set; + } + + public IReadOnlyList Bind + { + get => _which == WHICH.Bind ? (IReadOnlyList)_content : null; + set + { + _which = WHICH.Bind; + _content = value; + } + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(64U, (ushort)0); + public ulong ScopeId => ctx.ReadDataULong(0UL, 0UL); + public IReadOnlyList Bind => which == WHICH.Bind ? ctx.ReadList(0).Cast(CapnpC.CSharp.Generator.Schema.Brand.Binding.READER.create) : default; + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(2, 1); + } + + public WHICH which + { + get => (WHICH)this.ReadDataUShort(64U, (ushort)0); + set => this.WriteData(64U, (ushort)value, (ushort)0); + } + + public ulong ScopeId + { + get => this.ReadDataULong(0UL, 0UL); + set => this.WriteData(0UL, value, 0UL); + } + + public ListOfStructsSerializer Bind + { + get => which == WHICH.Bind ? BuildPointer>(0) : default; + set => Link(0, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xc863cd16969ee7fcUL)] + public class Binding : ICapnpSerializable + { + public const UInt64 typeId = 0xc863cd16969ee7fcUL; + public enum WHICH : ushort + { + Unbound = 0, + Type = 1, + undefined = 65535 + } + + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + switch (reader.which) + { + case WHICH.Unbound: + which = reader.which; + break; + case WHICH.Type: + Type = CapnpSerializable.Create(reader.Type); + break; + } + + applyDefaults(); + } + + private WHICH _which = WHICH.undefined; + private object _content; + public WHICH which + { + get => _which; + set + { + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.Unbound: + break; + case WHICH.Type: + _content = null; + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.Unbound: + break; + case WHICH.Type: + Type?.serialize(writer.Type); + break; + } + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public CapnpC.CSharp.Generator.Schema.Type Type + { + get => _which == WHICH.Type ? (CapnpC.CSharp.Generator.Schema.Type)_content : null; + set + { + _which = WHICH.Type; + _content = value; + } + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(0U, (ushort)0); + public CapnpC.CSharp.Generator.Schema.Type.READER Type => which == WHICH.Type ? ctx.ReadStruct(0, CapnpC.CSharp.Generator.Schema.Type.READER.create) : default; + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 1); + } + + public WHICH which + { + get => (WHICH)this.ReadDataUShort(0U, (ushort)0); + set => this.WriteData(0U, (ushort)value, (ushort)0); + } + + public CapnpC.CSharp.Generator.Schema.Type.WRITER Type + { + get => which == WHICH.Type ? BuildPointer(0) : default; + set => Link(0, value); + } + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xce23dcd2d7b00c9bUL)] + public class Value : ICapnpSerializable + { + public const UInt64 typeId = 0xce23dcd2d7b00c9bUL; + public enum WHICH : ushort + { + Void = 0, + Bool = 1, + Int8 = 2, + Int16 = 3, + Int32 = 4, + Int64 = 5, + Uint8 = 6, + Uint16 = 7, + Uint32 = 8, + Uint64 = 9, + Float32 = 10, + Float64 = 11, + Text = 12, + Data = 13, + List = 14, + Enum = 15, + Struct = 16, + Interface = 17, + AnyPointer = 18, + undefined = 65535 + } + + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + switch (reader.which) + { + case WHICH.Void: + which = reader.which; + break; + case WHICH.Bool: + Bool = reader.Bool; + break; + case WHICH.Int8: + Int8 = reader.Int8; + break; + case WHICH.Int16: + Int16 = reader.Int16; + break; + case WHICH.Int32: + Int32 = reader.Int32; + break; + case WHICH.Int64: + Int64 = reader.Int64; + break; + case WHICH.Uint8: + Uint8 = reader.Uint8; + break; + case WHICH.Uint16: + Uint16 = reader.Uint16; + break; + case WHICH.Uint32: + Uint32 = reader.Uint32; + break; + case WHICH.Uint64: + Uint64 = reader.Uint64; + break; + case WHICH.Float32: + Float32 = reader.Float32; + break; + case WHICH.Float64: + Float64 = reader.Float64; + break; + case WHICH.Text: + Text = reader.Text; + break; + case WHICH.Data: + Data = reader.Data; + break; + case WHICH.List: + List = CapnpSerializable.Create(reader.List); + break; + case WHICH.Enum: + Enum = reader.Enum; + break; + case WHICH.Struct: + Struct = CapnpSerializable.Create(reader.Struct); + break; + case WHICH.Interface: + which = reader.which; + break; + case WHICH.AnyPointer: + AnyPointer = CapnpSerializable.Create(reader.AnyPointer); + break; + } + + applyDefaults(); + } + + private WHICH _which = WHICH.undefined; + private object _content; + public WHICH which + { + get => _which; + set + { + if (value == _which) + return; + _which = value; + switch (value) + { + case WHICH.Void: + break; + case WHICH.Bool: + _content = false; + break; + case WHICH.Int8: + _content = 0; + break; + case WHICH.Int16: + _content = 0; + break; + case WHICH.Int32: + _content = 0; + break; + case WHICH.Int64: + _content = 0; + break; + case WHICH.Uint8: + _content = 0; + break; + case WHICH.Uint16: + _content = 0; + break; + case WHICH.Uint32: + _content = 0; + break; + case WHICH.Uint64: + _content = 0; + break; + case WHICH.Float32: + _content = 0F; + break; + case WHICH.Float64: + _content = 0; + break; + case WHICH.Text: + _content = null; + break; + case WHICH.Data: + _content = null; + break; + case WHICH.List: + _content = null; + break; + case WHICH.Enum: + _content = 0; + break; + case WHICH.Struct: + _content = null; + break; + case WHICH.Interface: + break; + case WHICH.AnyPointer: + _content = null; + break; + } + } + } + + public void serialize(WRITER writer) + { + writer.which = which; + switch (which) + { + case WHICH.Void: + break; + case WHICH.Bool: + writer.Bool = Bool.Value; + break; + case WHICH.Int8: + writer.Int8 = Int8.Value; + break; + case WHICH.Int16: + writer.Int16 = Int16.Value; + break; + case WHICH.Int32: + writer.Int32 = Int32.Value; + break; + case WHICH.Int64: + writer.Int64 = Int64.Value; + break; + case WHICH.Uint8: + writer.Uint8 = Uint8.Value; + break; + case WHICH.Uint16: + writer.Uint16 = Uint16.Value; + break; + case WHICH.Uint32: + writer.Uint32 = Uint32.Value; + break; + case WHICH.Uint64: + writer.Uint64 = Uint64.Value; + break; + case WHICH.Float32: + writer.Float32 = Float32.Value; + break; + case WHICH.Float64: + writer.Float64 = Float64.Value; + break; + case WHICH.Text: + writer.Text = Text; + break; + case WHICH.Data: + writer.Data.Init(Data); + break; + case WHICH.List: + writer.List.SetObject(List); + break; + case WHICH.Enum: + writer.Enum = Enum.Value; + break; + case WHICH.Struct: + writer.Struct.SetObject(Struct); + break; + case WHICH.Interface: + break; + case WHICH.AnyPointer: + writer.AnyPointer.SetObject(AnyPointer); + break; + } + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public bool? Bool + { + get => _which == WHICH.Bool ? (bool?)_content : null; + set + { + _which = WHICH.Bool; + _content = value; + } + } + + public sbyte? Int8 + { + get => _which == WHICH.Int8 ? (sbyte?)_content : null; + set + { + _which = WHICH.Int8; + _content = value; + } + } + + public short? Int16 + { + get => _which == WHICH.Int16 ? (short?)_content : null; + set + { + _which = WHICH.Int16; + _content = value; + } + } + + public int? Int32 + { + get => _which == WHICH.Int32 ? (int?)_content : null; + set + { + _which = WHICH.Int32; + _content = value; + } + } + + public long? Int64 + { + get => _which == WHICH.Int64 ? (long?)_content : null; + set + { + _which = WHICH.Int64; + _content = value; + } + } + + public byte? Uint8 + { + get => _which == WHICH.Uint8 ? (byte?)_content : null; + set + { + _which = WHICH.Uint8; + _content = value; + } + } + + public ushort? Uint16 + { + get => _which == WHICH.Uint16 ? (ushort?)_content : null; + set + { + _which = WHICH.Uint16; + _content = value; + } + } + + public uint? Uint32 + { + get => _which == WHICH.Uint32 ? (uint?)_content : null; + set + { + _which = WHICH.Uint32; + _content = value; + } + } + + public ulong? Uint64 + { + get => _which == WHICH.Uint64 ? (ulong?)_content : null; + set + { + _which = WHICH.Uint64; + _content = value; + } + } + + public float? Float32 + { + get => _which == WHICH.Float32 ? (float?)_content : null; + set + { + _which = WHICH.Float32; + _content = value; + } + } + + public double? Float64 + { + get => _which == WHICH.Float64 ? (double?)_content : null; + set + { + _which = WHICH.Float64; + _content = value; + } + } + + public string Text + { + get => _which == WHICH.Text ? (string)_content : null; + set + { + _which = WHICH.Text; + _content = value; + } + } + + public IReadOnlyList Data + { + get => _which == WHICH.Data ? (IReadOnlyList)_content : null; + set + { + _which = WHICH.Data; + _content = value; + } + } + + public object List + { + get => _which == WHICH.List ? (object)_content : null; + set + { + _which = WHICH.List; + _content = value; + } + } + + public ushort? Enum + { + get => _which == WHICH.Enum ? (ushort?)_content : null; + set + { + _which = WHICH.Enum; + _content = value; + } + } + + public object Struct + { + get => _which == WHICH.Struct ? (object)_content : null; + set + { + _which = WHICH.Struct; + _content = value; + } + } + + public object AnyPointer + { + get => _which == WHICH.AnyPointer ? (object)_content : null; + set + { + _which = WHICH.AnyPointer; + _content = value; + } + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public WHICH which => (WHICH)ctx.ReadDataUShort(0U, (ushort)0); + public bool Bool => which == WHICH.Bool ? ctx.ReadDataBool(16UL, false) : default; + public sbyte Int8 => which == WHICH.Int8 ? ctx.ReadDataSByte(16UL, (sbyte)0) : default; + public short Int16 => which == WHICH.Int16 ? ctx.ReadDataShort(16UL, (short)0) : default; + public int Int32 => which == WHICH.Int32 ? ctx.ReadDataInt(32UL, 0) : default; + public long Int64 => which == WHICH.Int64 ? ctx.ReadDataLong(64UL, 0L) : default; + public byte Uint8 => which == WHICH.Uint8 ? ctx.ReadDataByte(16UL, (byte)0) : default; + public ushort Uint16 => which == WHICH.Uint16 ? ctx.ReadDataUShort(16UL, (ushort)0) : default; + public uint Uint32 => which == WHICH.Uint32 ? ctx.ReadDataUInt(32UL, 0U) : default; + public ulong Uint64 => which == WHICH.Uint64 ? ctx.ReadDataULong(64UL, 0UL) : default; + public float Float32 => which == WHICH.Float32 ? ctx.ReadDataFloat(32UL, 0F) : default; + public double Float64 => which == WHICH.Float64 ? ctx.ReadDataDouble(64UL, 0) : default; + public string Text => which == WHICH.Text ? ctx.ReadText(0, null) : default; + public IReadOnlyList Data => which == WHICH.Data ? ctx.ReadList(0).CastByte() : default; + public DeserializerState List => which == WHICH.List ? ctx.StructReadPointer(0) : default; + public ushort Enum => which == WHICH.Enum ? ctx.ReadDataUShort(16UL, (ushort)0) : default; + public DeserializerState Struct => which == WHICH.Struct ? ctx.StructReadPointer(0) : default; + public DeserializerState AnyPointer => which == WHICH.AnyPointer ? ctx.StructReadPointer(0) : default; + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(2, 1); + } + + public WHICH which + { + get => (WHICH)this.ReadDataUShort(0U, (ushort)0); + set => this.WriteData(0U, (ushort)value, (ushort)0); + } + + public bool Bool + { + get => which == WHICH.Bool ? this.ReadDataBool(16UL, false) : default; + set => this.WriteData(16UL, value, false); + } + + public sbyte Int8 + { + get => which == WHICH.Int8 ? this.ReadDataSByte(16UL, (sbyte)0) : default; + set => this.WriteData(16UL, value, (sbyte)0); + } + + public short Int16 + { + get => which == WHICH.Int16 ? this.ReadDataShort(16UL, (short)0) : default; + set => this.WriteData(16UL, value, (short)0); + } + + public int Int32 + { + get => which == WHICH.Int32 ? this.ReadDataInt(32UL, 0) : default; + set => this.WriteData(32UL, value, 0); + } + + public long Int64 + { + get => which == WHICH.Int64 ? this.ReadDataLong(64UL, 0L) : default; + set => this.WriteData(64UL, value, 0L); + } + + public byte Uint8 + { + get => which == WHICH.Uint8 ? this.ReadDataByte(16UL, (byte)0) : default; + set => this.WriteData(16UL, value, (byte)0); + } + + public ushort Uint16 + { + get => which == WHICH.Uint16 ? this.ReadDataUShort(16UL, (ushort)0) : default; + set => this.WriteData(16UL, value, (ushort)0); + } + + public uint Uint32 + { + get => which == WHICH.Uint32 ? this.ReadDataUInt(32UL, 0U) : default; + set => this.WriteData(32UL, value, 0U); + } + + public ulong Uint64 + { + get => which == WHICH.Uint64 ? this.ReadDataULong(64UL, 0UL) : default; + set => this.WriteData(64UL, value, 0UL); + } + + public float Float32 + { + get => which == WHICH.Float32 ? this.ReadDataFloat(32UL, 0F) : default; + set => this.WriteData(32UL, value, 0F); + } + + public double Float64 + { + get => which == WHICH.Float64 ? this.ReadDataDouble(64UL, 0) : default; + set => this.WriteData(64UL, value, 0); + } + + public string Text + { + get => which == WHICH.Text ? this.ReadText(0, null) : default; + set => this.WriteText(0, value, null); + } + + public ListOfPrimitivesSerializer Data + { + get => which == WHICH.Data ? BuildPointer>(0) : default; + set => Link(0, value); + } + + public DynamicSerializerState List + { + get => which == WHICH.List ? BuildPointer(0) : default; + set => Link(0, value); + } + + public ushort Enum + { + get => which == WHICH.Enum ? this.ReadDataUShort(16UL, (ushort)0) : default; + set => this.WriteData(16UL, value, (ushort)0); + } + + public DynamicSerializerState Struct + { + get => which == WHICH.Struct ? BuildPointer(0) : default; + set => Link(0, value); + } + + public DynamicSerializerState AnyPointer + { + get => which == WHICH.AnyPointer ? BuildPointer(0) : default; + set => Link(0, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xf1c8950dab257542UL)] + public class Annotation : ICapnpSerializable + { + public const UInt64 typeId = 0xf1c8950dab257542UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Id = reader.Id; + Value = CapnpSerializable.Create(reader.Value); + Brand = CapnpSerializable.Create(reader.Brand); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Id = Id; + Value?.serialize(writer.Value); + Brand?.serialize(writer.Brand); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong Id + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Value Value + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.Brand Brand + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong Id => ctx.ReadDataULong(0UL, 0UL); + public CapnpC.CSharp.Generator.Schema.Value.READER Value => ctx.ReadStruct(0, CapnpC.CSharp.Generator.Schema.Value.READER.create); + public CapnpC.CSharp.Generator.Schema.Brand.READER Brand => ctx.ReadStruct(1, CapnpC.CSharp.Generator.Schema.Brand.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 2); + } + + public ulong Id + { + get => this.ReadDataULong(0UL, 0UL); + set => this.WriteData(0UL, value, 0UL); + } + + public CapnpC.CSharp.Generator.Schema.Value.WRITER Value + { + get => BuildPointer(0); + set => Link(0, value); + } + + public CapnpC.CSharp.Generator.Schema.Brand.WRITER Brand + { + get => BuildPointer(1); + set => Link(1, value); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xd1958f7dba521926UL)] + public enum ElementSize : ushort + { + empty, + bit, + @byte, + twoBytes, + fourBytes, + eightBytes, + pointer, + inlineComposite + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xd85d305b7d839963UL)] + public class CapnpVersion : ICapnpSerializable + { + public const UInt64 typeId = 0xd85d305b7d839963UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Major = reader.Major; + Minor = reader.Minor; + Micro = reader.Micro; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Major = Major; + writer.Minor = Minor; + writer.Micro = Micro; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ushort Major + { + get; + set; + } + + public byte Minor + { + get; + set; + } + + public byte Micro + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ushort Major => ctx.ReadDataUShort(0UL, (ushort)0); + public byte Minor => ctx.ReadDataByte(16UL, (byte)0); + public byte Micro => ctx.ReadDataByte(24UL, (byte)0); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 0); + } + + public ushort Major + { + get => this.ReadDataUShort(0UL, (ushort)0); + set => this.WriteData(0UL, value, (ushort)0); + } + + public byte Minor + { + get => this.ReadDataByte(16UL, (byte)0); + set => this.WriteData(16UL, value, (byte)0); + } + + public byte Micro + { + get => this.ReadDataByte(24UL, (byte)0); + set => this.WriteData(24UL, value, (byte)0); + } + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xbfc546f6210ad7ceUL)] + public class CodeGeneratorRequest : ICapnpSerializable + { + public const UInt64 typeId = 0xbfc546f6210ad7ceUL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Nodes = reader.Nodes?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + RequestedFiles = reader.RequestedFiles?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + CapnpVersion = CapnpSerializable.Create(reader.CapnpVersion); + SourceInfo = reader.SourceInfo?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Nodes.Init(Nodes, (_s1, _v1) => _v1?.serialize(_s1)); + writer.RequestedFiles.Init(RequestedFiles, (_s1, _v1) => _v1?.serialize(_s1)); + CapnpVersion?.serialize(writer.CapnpVersion); + writer.SourceInfo.Init(SourceInfo, (_s1, _v1) => _v1?.serialize(_s1)); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public IReadOnlyList Nodes + { + get; + set; + } + + public IReadOnlyList RequestedFiles + { + get; + set; + } + + public CapnpC.CSharp.Generator.Schema.CapnpVersion CapnpVersion + { + get; + set; + } + + public IReadOnlyList SourceInfo + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public IReadOnlyList Nodes => ctx.ReadList(0).Cast(CapnpC.CSharp.Generator.Schema.Node.READER.create); + public IReadOnlyList RequestedFiles => ctx.ReadList(1).Cast(CapnpC.CSharp.Generator.Schema.CodeGeneratorRequest.RequestedFile.READER.create); + public CapnpC.CSharp.Generator.Schema.CapnpVersion.READER CapnpVersion => ctx.ReadStruct(2, CapnpC.CSharp.Generator.Schema.CapnpVersion.READER.create); + public IReadOnlyList SourceInfo => ctx.ReadList(3).Cast(CapnpC.CSharp.Generator.Schema.Node.SourceInfo.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(0, 4); + } + + public ListOfStructsSerializer Nodes + { + get => BuildPointer>(0); + set => Link(0, value); + } + + public ListOfStructsSerializer RequestedFiles + { + get => BuildPointer>(1); + set => Link(1, value); + } + + public CapnpC.CSharp.Generator.Schema.CapnpVersion.WRITER CapnpVersion + { + get => BuildPointer(2); + set => Link(2, value); + } + + public ListOfStructsSerializer SourceInfo + { + get => BuildPointer>(3); + set => Link(3, value); + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xcfea0eb02e810062UL)] + public class RequestedFile : ICapnpSerializable + { + public const UInt64 typeId = 0xcfea0eb02e810062UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Id = reader.Id; + Filename = reader.Filename; + Imports = reader.Imports?.ToReadOnlyList(_ => CapnpSerializable.Create(_)); + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Id = Id; + writer.Filename = Filename; + writer.Imports.Init(Imports, (_s1, _v1) => _v1?.serialize(_s1)); + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong Id + { + get; + set; + } + + public string Filename + { + get; + set; + } + + public IReadOnlyList Imports + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong Id => ctx.ReadDataULong(0UL, 0UL); + public string Filename => ctx.ReadText(0, null); + public IReadOnlyList Imports => ctx.ReadList(1).Cast(CapnpC.CSharp.Generator.Schema.CodeGeneratorRequest.RequestedFile.Import.READER.create); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 2); + } + + public ulong Id + { + get => this.ReadDataULong(0UL, 0UL); + set => this.WriteData(0UL, value, 0UL); + } + + public string Filename + { + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + + public ListOfStructsSerializer Imports + { + get => BuildPointer>(1); + set => Link(1, value); + } + } + + [System.CodeDom.Compiler.GeneratedCode("capnpc-csharp", "1.3.0.0"), TypeId(0xae504193122357e5UL)] + public class Import : ICapnpSerializable + { + public const UInt64 typeId = 0xae504193122357e5UL; + void ICapnpSerializable.Deserialize(DeserializerState arg_) + { + var reader = READER.create(arg_); + Id = reader.Id; + Name = reader.Name; + applyDefaults(); + } + + public void serialize(WRITER writer) + { + writer.Id = Id; + writer.Name = Name; + } + + void ICapnpSerializable.Serialize(SerializerState arg_) + { + serialize(arg_.Rewrap()); + } + + public void applyDefaults() + { + } + + public ulong Id + { + get; + set; + } + + public string Name + { + get; + set; + } + + public struct READER + { + readonly DeserializerState ctx; + public READER(DeserializerState ctx) + { + this.ctx = ctx; + } + + public static READER create(DeserializerState ctx) => new READER(ctx); + public static implicit operator DeserializerState(READER reader) => reader.ctx; + public static implicit operator READER(DeserializerState ctx) => new READER(ctx); + public ulong Id => ctx.ReadDataULong(0UL, 0UL); + public string Name => ctx.ReadText(0, null); + } + + public class WRITER : SerializerState + { + public WRITER() + { + this.SetStruct(1, 1); + } + + public ulong Id + { + get => this.ReadDataULong(0UL, 0UL); + set => this.WriteData(0UL, value, 0UL); + } + + public string Name + { + get => this.ReadText(0, null); + set => this.WriteText(0, value, null); + } + } + } + } + } +} \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 933127e..2f119b9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -83,10 +83,10 @@ test_script: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.MsBuild.Generation.Tests\bin\Release\netcoreapp3.0\CapnpC.CSharp.MsBuild.Generation.Tests.dll msbuild -t:restore ./MsBuildGenerationTest/MsBuildGenerationTest.csproj /p:Configuration="Debug" /p:PackageReferenceVersion="%VERSION%" msbuild ./MsBuildGenerationTest/MsBuildGenerationTest.sln /p:Configuration="Debug" /p:PackageReferenceVersion="%VERSION%" - vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Debug\net471\Capnp.Net.Runtime.Tests.Std20.dll - vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Release\net471\Capnp.Net.Runtime.Tests.Std20.dll - vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Debug\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll - vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Release\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll + vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Debug\net471\Capnp.Net.Runtime.Tests.dll + vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Release\net471\Capnp.Net.Runtime.Tests.dll + vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Debug\netcoreapp2.1\Capnp.Net.Runtime.Tests.dll + vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Release\netcoreapp2.1\Capnp.Net.Runtime.Tests.dll powershell -File .\scripts\measure-coverage.ps1 csmacnz.Coveralls --multiple -i "opencover=coverage\cov-Capnp.Net.Runtime.xml;opencover=coverage\cov-CapnpC.CSharp.Generator.xml" --repoToken %COVERALLS_REPO_TOKEN% on_finish :