public Cursor(StatefulFilterTransform <TSrc, TDst, TState> parent, RowCursor <TSrc> input, IEnumerable <DataViewSchema.Column> columnsNeeded)
                : base(parent.Host)
            {
                Ch.AssertValue(input);
                Ch.AssertValue(columnsNeeded);

                _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);

                parent._initStateAction?.Invoke(_state);

                var appendedDataView = new DataViewConstructionUtils.SingleRowLoopDataView <TDst>(parent.Host, _parent._addedSchema);

                appendedDataView.SetCurrentRowObject(_dst);

                var columnNames = columnsNeeded.Select(c => c.Name);

                _appendedRow = appendedDataView.GetRowCursor(appendedDataView.Schema.Where(c => !c.IsHidden && columnNames.Contains(c.Name)));
            }
Beispiel #2
0
            public Cursor(StatefulFilterTransform <TSrc, TDst, TState> parent, RowCursor <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);
            }