/// <summary> /// Returns a value getter delegate to fetch the value of column with the given columnIndex, from the row. /// This throws if the column is not active in this row, or if the type /// <typeparamref name="TValue"/> differs from this column's type. /// </summary> /// <typeparam name="TValue"> is the column's content type.</typeparam> /// <param name="column"> is the output column whose getter should be returned.</param> public override ValueGetter <TValue> GetGetter <TValue>(DataViewSchema.Column column) { bool isSrc; int index = _parent.MapColumnIndex(out isSrc, column.Index); if (isSrc) { return(Input.GetGetter <TValue>(Input.Schema[index])); } Contracts.Assert(_getters[index] != null); var fn = _getters[index] as ValueGetter <TValue>; if (fn == null) { throw Contracts.Except("Invalid TValue in GetGetter: '{0}'", typeof(TValue)); } return(fn); }
/// <summary> /// Returns a value getter delegate to fetch the value of column with the given columnIndex, from the row. /// This throws if the column is not active in this row, or if the type /// <typeparamref name="TValue"/> differs from this column's type. /// </summary> /// <typeparam name="TValue"> is the column's content type.</typeparam> /// <param name="column"> is the output column whose getter should be returned.</param> public override ValueGetter <TValue> GetGetter <TValue>(DataViewSchema.Column column) { bool isSrc; int index = _parent.MapColumnIndex(out isSrc, column.Index); if (isSrc) { return(Input.GetGetter <TValue>(Input.Schema[index])); } var originFn = _getters[index]; Contracts.Assert(originFn != null); var fn = originFn as ValueGetter <TValue>; if (fn == null) { throw Contracts.Except($"Invalid TValue in GetGetter: '{typeof(TValue)}', " + $"expected type: '{originFn.GetType().GetGenericArguments().First()}'."); } return(fn); }