/// <summary> /// Creates a wrapped version of the cursor /// </summary> /// <param name="provider">Channel provider</param> /// <param name="input">The input cursor</param> /// <param name="bindings">The bindings object, </param> public BindingsWrappedRowCursor(IChannelProvider provider, RowCursor input, ColumnBindingsBase bindings) : base(provider, input) { Ch.CheckValue(input, nameof(input)); Ch.CheckValue(bindings, nameof(bindings)); _bindings = bindings; }
private static DataViewSchema CreateSchema(ColumnBindingsBase inputBindings) { Contracts.CheckValue(inputBindings, nameof(inputBindings)); var builder = new SchemaBuilder(); for (int i = 0; i < inputBindings.ColumnCount; i++) { var meta = new MetadataBuilder(); foreach (var kvp in inputBindings.GetMetadataTypes(i)) { var getter = Utils.MarshalInvoke(GetMetadataGetterDelegate <int>, kvp.Value.RawType, inputBindings, i, kvp.Key); meta.Add(kvp.Key, kvp.Value, getter); } builder.AddColumn(inputBindings.GetColumnName(i), inputBindings.GetColumnType(i), meta.GetMetadata()); } return(builder.GetSchema()); }
private static Delegate GetMetadataGetterDelegate <TValue>(ColumnBindingsBase bindings, int col, string kind) { ValueGetter <TValue> getter = (ref TValue value) => bindings.GetMetadata(kind, col, ref value); return(getter); }