public Cursor(StatefulFilterTransform <TSrc, TDst, TState> parent, IRowCursor <TSrc> input, Func <int, bool> predicate) : base(parent.Host) { Ch.AssertValue(input); Ch.AssertValue(predicate); _parent = parent; _input = input; _src = new TSrc(); _dst = new TDst(); _state = new TState(); CursorChannelAttribute.TrySetCursorChannel(_parent.Host, _src, Ch); CursorChannelAttribute.TrySetCursorChannel(_parent.Host, _dst, Ch); CursorChannelAttribute.TrySetCursorChannel(_parent.Host, _state, Ch); if (parent._initStateAction != null) { parent._initStateAction(_state); } var appendedDataView = new DataViewConstructionUtils.SingleRowLoopDataView <TDst>(parent.Host, _parent._addedSchema); appendedDataView.SetCurrentRowObject(_dst); Func <int, bool> appendedPredicate = col => { col = _parent._bindings.AddedColumnIndices[col]; return(predicate(col)); }; _appendedRow = appendedDataView.GetRowCursor(appendedPredicate); }
private IRow GetAppendedRow(Func <int, bool> active, TDst dst) { // REVIEW: This is quite odd (for a cursor to create an IDataView). Consider cleaning up your // programming model for this. Note that you don't use the IDataView, only a cursor around a single row that // is owned by this cursor. Seems like that cursor implementation could be decoupled from any IDataView class. var appendedDataView = new DataViewConstructionUtils.SingleRowLoopDataView <TDst>(Host, _schema.AddedSchema); appendedDataView.SetCurrentRowObject(dst); return(appendedDataView.GetRowCursor(i => active(_schema.MapIinfoToCol(i)))); }