public void WriteThrift(TextWriter tw, string basename, IEnumerable <CatalogEntry> entries) { var operators = entries.Where(e => e.IsCode) .Select(e => e.CodeValue.Value).ToArray(); AddTypes(operators .Select(e => e.ReturnType)); AddTypes(operators .SelectMany(e => e.Lookup.Columns.Select(c => c.DataType))); ThriftGen.Process(tw, basename, _datatypes.ToArray(), operators); }
// write an entire Thrift IDL to the test writer public static void Process(TextWriter tw, string basename, DataType[] types, ExpressionBlock[] exprs) { var gen = new ThriftGen() { Templater = new ThriftTemplater() }; tw.Write(gen.Heading(basename)); var names = new HashSet <string>(); foreach (var t in types.OrderBy(d => d.GetNiceName)) { if (!names.Contains(t.GetNiceName)) { tw.Write(gen.Struct(t.GetNiceName, t.Heading.Columns)); } names.Add(t.GetNiceName); } tw.Write(gen.Service(basename, exprs.OrderBy(e => e.Name).ToArray())); }