summaryrefslogtreecommitdiff
path: root/ddl/out/LambdaCube.PipelineSchema.cs
blob: c05a307063cc74d51e7ab83d2e4f852d0b496dc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
// generated file, do not modify!
// 2016-11-10T16:02:38.214442000000Z

using System;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;

using LambdaCube.IR;

namespace LambdaCube.PipelineSchema {
  public class StreamType {
      public enum Tag { 
        Attribute_Word,
        Attribute_V2U,
        Attribute_V3U,
        Attribute_V4U,
        Attribute_Int,
        Attribute_V2I,
        Attribute_V3I,
        Attribute_V4I,
        Attribute_Float,
        Attribute_V2F,
        Attribute_V3F,
        Attribute_V4F,
        Attribute_M22F,
        Attribute_M23F,
        Attribute_M24F,
        Attribute_M32F,
        Attribute_M33F,
        Attribute_M34F,
        Attribute_M42F,
        Attribute_M43F,
        Attribute_M44F
      };
      public Tag tag;
  };

  namespace data { 
  }
  public class ObjectArraySchema {
      public enum Tag { 
        ObjectArraySchema
      };
      public Tag tag;
  };

  namespace data { 
    public class ObjectArraySchema : LambdaCube.PipelineSchema.ObjectArraySchema { 
      public global::LambdaCube.PipelineSchema.FetchPrimitive primitive;
      public Dictionary<string, global::LambdaCube.PipelineSchema.StreamType> attributes;
      public ObjectArraySchema() { tag = LambdaCube.PipelineSchema.ObjectArraySchema.Tag.ObjectArraySchema; }
    };
  }
  public class PipelineSchema {
      public enum Tag { 
        PipelineSchema
      };
      public Tag tag;
  };

  namespace data { 
    public class PipelineSchema : LambdaCube.PipelineSchema.PipelineSchema { 
      public Dictionary<string, global::LambdaCube.PipelineSchema.ObjectArraySchema> objectArrays;
      public Dictionary<string, global::LambdaCube.PipelineSchema.InputType> uniforms;
      public PipelineSchema() { tag = LambdaCube.PipelineSchema.PipelineSchema.Tag.PipelineSchema; }
    };
  }

  // JSON deserializer
  public enum Type { 
    String,
    Map_String_InputType,
    Map_String_ObjectArraySchema,
    Map_String_StreamType,
    FetchPrimitive,
    InputType,
    ObjectArraySchema,
    PipelineSchema,
    StreamType
  }

  public class Loader {
    public static object fromJSON(Type type, JToken obj) {
      switch (type) {
        case Type.String: return (string)obj;
        case Type.Map_String_InputType: {
          var map = new Dictionary<string, global::LambdaCube.PipelineSchema.InputType> ();
          foreach(var i in (JObject)obj) {
            map.Add( (string)fromJSON(Type.String,i.Key)
                   , (global::LambdaCube.PipelineSchema.InputType)fromJSON(Type.InputType,i.Value));
          }
          return map;
        }
        case Type.Map_String_ObjectArraySchema: {
          var map = new Dictionary<string, global::LambdaCube.PipelineSchema.ObjectArraySchema> ();
          foreach(var i in (JObject)obj) {
            map.Add( (string)fromJSON(Type.String,i.Key)
                   , (global::LambdaCube.PipelineSchema.ObjectArraySchema)fromJSON(Type.ObjectArraySchema,i.Value));
          }
          return map;
        }
        case Type.Map_String_StreamType: {
          var map = new Dictionary<string, global::LambdaCube.PipelineSchema.StreamType> ();
          foreach(var i in (JObject)obj) {
            map.Add( (string)fromJSON(Type.String,i.Key)
                   , (global::LambdaCube.PipelineSchema.StreamType)fromJSON(Type.StreamType,i.Value));
          }
          return map;
        }

        case Type.StreamType: {
          string tag = (string)obj["tag"];
          StreamType.Tag tagType;
          switch (tag) {
            case "Attribute_Word": tagType = StreamType.Tag.Attribute_Word; break;
            case "Attribute_V2U": tagType = StreamType.Tag.Attribute_V2U; break;
            case "Attribute_V3U": tagType = StreamType.Tag.Attribute_V3U; break;
            case "Attribute_V4U": tagType = StreamType.Tag.Attribute_V4U; break;
            case "Attribute_Int": tagType = StreamType.Tag.Attribute_Int; break;
            case "Attribute_V2I": tagType = StreamType.Tag.Attribute_V2I; break;
            case "Attribute_V3I": tagType = StreamType.Tag.Attribute_V3I; break;
            case "Attribute_V4I": tagType = StreamType.Tag.Attribute_V4I; break;
            case "Attribute_Float": tagType = StreamType.Tag.Attribute_Float; break;
            case "Attribute_V2F": tagType = StreamType.Tag.Attribute_V2F; break;
            case "Attribute_V3F": tagType = StreamType.Tag.Attribute_V3F; break;
            case "Attribute_V4F": tagType = StreamType.Tag.Attribute_V4F; break;
            case "Attribute_M22F": tagType = StreamType.Tag.Attribute_M22F; break;
            case "Attribute_M23F": tagType = StreamType.Tag.Attribute_M23F; break;
            case "Attribute_M24F": tagType = StreamType.Tag.Attribute_M24F; break;
            case "Attribute_M32F": tagType = StreamType.Tag.Attribute_M32F; break;
            case "Attribute_M33F": tagType = StreamType.Tag.Attribute_M33F; break;
            case "Attribute_M34F": tagType = StreamType.Tag.Attribute_M34F; break;
            case "Attribute_M42F": tagType = StreamType.Tag.Attribute_M42F; break;
            case "Attribute_M43F": tagType = StreamType.Tag.Attribute_M43F; break;
            case "Attribute_M44F": tagType = StreamType.Tag.Attribute_M44F; break;
            default: throw new Exception("unknown constructor: " + tag);
          }
          StreamType o = new StreamType();
          o.tag = tagType;
          return o;
        }
        case Type.ObjectArraySchema: {
          string tag = (string)obj["tag"];
          switch (tag) {
            case "ObjectArraySchema": {
              data.ObjectArraySchema tv = new data.ObjectArraySchema();
              tv.primitive = (global::LambdaCube.PipelineSchema.FetchPrimitive)fromJSON(Type.FetchPrimitive,obj["primitive"]);
              tv.attributes = (Dictionary<string, global::LambdaCube.PipelineSchema.StreamType>)fromJSON(Type.Map_String_StreamType,obj["attributes"]);
              return tv;
            }
            default: throw new Exception("unknown constructor: " + tag);
          }
        }
        case Type.PipelineSchema: {
          string tag = (string)obj["tag"];
          switch (tag) {
            case "PipelineSchema": {
              data.PipelineSchema tv = new data.PipelineSchema();
              tv.objectArrays = (Dictionary<string, global::LambdaCube.PipelineSchema.ObjectArraySchema>)fromJSON(Type.Map_String_ObjectArraySchema,obj["objectArrays"]);
              tv.uniforms = (Dictionary<string, global::LambdaCube.PipelineSchema.InputType>)fromJSON(Type.Map_String_InputType,obj["uniforms"]);
              return tv;
            }
            default: throw new Exception("unknown constructor: " + tag);
          }
        }
      }
      throw new Exception("unknown type");
      return null;
    }

    public static JToken toJSON(StreamType v) {
      var obj = new JObject();
      switch (v.tag) { 
        case StreamType.Tag.Attribute_Word:
          obj["tag"] = "Attribute_Word";
          break;
        case StreamType.Tag.Attribute_V2U:
          obj["tag"] = "Attribute_V2U";
          break;
        case StreamType.Tag.Attribute_V3U:
          obj["tag"] = "Attribute_V3U";
          break;
        case StreamType.Tag.Attribute_V4U:
          obj["tag"] = "Attribute_V4U";
          break;
        case StreamType.Tag.Attribute_Int:
          obj["tag"] = "Attribute_Int";
          break;
        case StreamType.Tag.Attribute_V2I:
          obj["tag"] = "Attribute_V2I";
          break;
        case StreamType.Tag.Attribute_V3I:
          obj["tag"] = "Attribute_V3I";
          break;
        case StreamType.Tag.Attribute_V4I:
          obj["tag"] = "Attribute_V4I";
          break;
        case StreamType.Tag.Attribute_Float:
          obj["tag"] = "Attribute_Float";
          break;
        case StreamType.Tag.Attribute_V2F:
          obj["tag"] = "Attribute_V2F";
          break;
        case StreamType.Tag.Attribute_V3F:
          obj["tag"] = "Attribute_V3F";
          break;
        case StreamType.Tag.Attribute_V4F:
          obj["tag"] = "Attribute_V4F";
          break;
        case StreamType.Tag.Attribute_M22F:
          obj["tag"] = "Attribute_M22F";
          break;
        case StreamType.Tag.Attribute_M23F:
          obj["tag"] = "Attribute_M23F";
          break;
        case StreamType.Tag.Attribute_M24F:
          obj["tag"] = "Attribute_M24F";
          break;
        case StreamType.Tag.Attribute_M32F:
          obj["tag"] = "Attribute_M32F";
          break;
        case StreamType.Tag.Attribute_M33F:
          obj["tag"] = "Attribute_M33F";
          break;
        case StreamType.Tag.Attribute_M34F:
          obj["tag"] = "Attribute_M34F";
          break;
        case StreamType.Tag.Attribute_M42F:
          obj["tag"] = "Attribute_M42F";
          break;
        case StreamType.Tag.Attribute_M43F:
          obj["tag"] = "Attribute_M43F";
          break;
        case StreamType.Tag.Attribute_M44F:
          obj["tag"] = "Attribute_M44F";
          break;
      }
      return obj;
    }
    public static JToken toJSON(ObjectArraySchema v) {
      var obj = new JObject();
      switch (v.tag) { 
        case ObjectArraySchema.Tag.ObjectArraySchema:
          obj["tag"] = "ObjectArraySchema";
          {
            var tv = (data.ObjectArraySchema)v;
            obj["primitive"] = toJSON(tv.primitive);
            obj["attributes"] = toJSON(tv.attributes);
          }
          break;
      }
      return obj;
    }
    public static JToken toJSON(PipelineSchema v) {
      var obj = new JObject();
      switch (v.tag) { 
        case PipelineSchema.Tag.PipelineSchema:
          obj["tag"] = "PipelineSchema";
          {
            var tv = (data.PipelineSchema)v;
            obj["objectArrays"] = toJSON(tv.objectArrays);
            obj["uniforms"] = toJSON(tv.uniforms);
          }
          break;
      }
      return obj;
    }

    public static JToken toJSON(string v) { return new JValue(v); }
    public static JToken toJSON(Dictionary<string, global::LambdaCube.PipelineSchema.InputType> v) {
      var obj = new JObject();
      foreach (var i in v) {
        obj[i.Key] = toJSON(i.Value);
      }
      return obj;
    }
    public static JToken toJSON(Dictionary<string, global::LambdaCube.PipelineSchema.ObjectArraySchema> v) {
      var obj = new JObject();
      foreach (var i in v) {
        obj[i.Key] = toJSON(i.Value);
      }
      return obj;
    }
    public static JToken toJSON(Dictionary<string, global::LambdaCube.PipelineSchema.StreamType> v) {
      var obj = new JObject();
      foreach (var i in v) {
        obj[i.Key] = toJSON(i.Value);
      }
      return obj;
    }
  }
}