protected override void GetAnnotationCore <TValue>(string kind, int iinfo, ref TValue value) { if (kind == AnnotationUtils.Kinds.ScoreColumnKind) { _getScoreColumnKind.Marshal(iinfo, ref value); return; } if (iinfo < DerivedColumnCount && kind == AnnotationUtils.Kinds.ScoreValueKind) { _getScoreValueKind.Marshal(iinfo, ref value); return; } if (iinfo < DerivedColumnCount && _predColMetadata != null) { var mcol = _predColMetadata.Schema.GetColumnOrNull(kind); if (mcol.HasValue) { // REVIEW: In the event that TValue is not the right type, it won't really be // the "right" type of exception. However considering that I consider the metadata // schema as it stands right now to be temporary, let's suppose we don't really care. _predColMetadata.GetGetter <TValue>(mcol.Value)(ref value); return; } } base.GetAnnotationCore <TValue>(kind, iinfo, ref value); }
private static DataViewSchema.Annotations KeyValueMetadataFromMetadata<T>(DataViewSchema.Annotations meta, DataViewSchema.Column metaCol) { Contracts.AssertValue(meta); Contracts.Assert(metaCol.Type.RawType == typeof(T)); var builder = new DataViewSchema.Annotations.Builder(); builder.Add(AnnotationUtils.Kinds.KeyValues, metaCol.Type, meta.GetGetter<T>(metaCol)); return builder.ToAnnotations(); }
/// <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) => _annotations.GetGetter <TValue>(column);
public override ValueGetter <TValue> GetGetter <TValue>(int col) => _annotations.GetGetter <TValue>(col);