Beispiel #1
0
        /// <summary>
        /// Initializes the specified prepare context.
        /// </summary>
        /// <param name="prepareContext">The prepare context.</param>
        /// <returns></returns>
        /// <exception cref="ExprValidationException">
        /// Filter requires single input port
        /// or
        /// Required parameter 'filter' providing the filter expression is not provided
        /// </exception>
        /// <exception cref="ArgumentException">Filter operator requires one or two output Stream(s) but produces " + prepareContext.OutputPorts.Count + " streams</exception>
#pragma warning disable RCS1168
        public DataFlowOpInitializeResult Initialize(DataFlowOpInitializateContext prepareContext)
#pragma warning restore RCS1168
        {
            if (prepareContext.InputPorts.Count != 1)
            {
                throw new ExprValidationException("Filter requires single input port");
            }
            if (filter == null)
            {
                throw new ExprValidationException("Required parameter 'filter' providing the filter expression is not provided");
            }
            if (prepareContext.OutputPorts.IsEmpty() || prepareContext.OutputPorts.Count > 2)
            {
                throw new ArgumentException("Filter operator requires one or two output Stream(s) but produces " + prepareContext.OutputPorts.Count + " streams");
            }

            EventType eventType = prepareContext.InputPorts[0].TypeDesc.EventType;

            _singleOutputPort = prepareContext.OutputPorts.Count == 1;

            ExprNode validated = ExprNodeUtility.ValidateSimpleGetSubtree(ExprNodeOrigin.DATAFLOWFILTER, filter, prepareContext.StatementContext, eventType, false);

            _evaluator          = validated.ExprEvaluator;
            _theEvent           = prepareContext.ServicesContext.EventAdapterService.GetShellForType(eventType);
            _eventsPerStream[0] = _theEvent;

            var typesPerPort = new GraphTypeDesc[prepareContext.OutputPorts.Count];

            for (int i = 0; i < typesPerPort.Length; i++)
            {
                typesPerPort[i] = new GraphTypeDesc(false, true, eventType);
            }
            return(new DataFlowOpInitializeResult(typesPerPort));
        }
Beispiel #2
0
 public DataFlowOpInputPort(GraphTypeDesc typeDesc, ICollection <String> streamNames, String optionalAlias, bool hasPunctuationSignal)
 {
     TypeDesc             = typeDesc;
     StreamNames          = streamNames;
     OptionalAlias        = optionalAlias;
     HasPunctuationSignal = hasPunctuationSignal;
 }
Beispiel #3
0
        public DataFlowOpForgeInitializeResult InitializeForge(DataFlowOpForgeInitializeContext context)
        {
            if (context.InputPorts.Count != 1) {
                throw new ExprValidationException("Filter requires single input port");
            }

            if (filter == null) {
                throw new ExprValidationException(
                    "Required parameter 'filter' providing the filter expression is not provided");
            }

            if (context.OutputPorts.IsEmpty() || context.OutputPorts.Count > 2) {
                throw new ArgumentException(
                    "Filter operator requires one or two output stream(s) but produces " +
                    context.OutputPorts.Count +
                    " streams");
            }

            eventType = context.InputPorts[0].TypeDesc.EventType;
            singleOutputPort = context.OutputPorts.Count == 1;

            filter = DataFlowParameterValidation.Validate("filter", filter, eventType, typeof(bool?), context);

            GraphTypeDesc[] typesPerPort = new GraphTypeDesc[context.OutputPorts.Count];
            for (int i = 0; i < typesPerPort.Length; i++) {
                typesPerPort[i] = new GraphTypeDesc(false, true, eventType);
            }

            return new DataFlowOpForgeInitializeResult(typesPerPort);
        }
Beispiel #4
0
 public DataFlowOpOutputPort(
     string streamName,
     GraphTypeDesc optionalDeclaredType)
 {
     StreamName           = streamName;
     OptionalDeclaredType = optionalDeclaredType;
 }
Beispiel #5
0
 public LogicalChannelProducingPortCompiled(
     int producingOpNum,
     string producingOpPrettyPrint,
     string streamName,
     int streamNumber,
     GraphTypeDesc graphTypeDesc,
     bool hasPunctuation)
 {
     ProducingOpNum = producingOpNum;
     ProducingOpPrettyPrint = producingOpPrettyPrint;
     StreamName = streamName;
     StreamNumber = streamNumber;
     GraphTypeDesc = graphTypeDesc;
     HasPunctuation = hasPunctuation;
 }
Beispiel #6
0
 public LogicalChannelProducingPortDeclared(
     int producingOpNum,
     string producingOpPrettyPrint,
     string streamName,
     int streamNumber,
     GraphTypeDesc typeDesc,
     bool hasPunctuation)
 {
     this.producingOpNum = producingOpNum;
     this.producingOpPrettyPrint = producingOpPrettyPrint;
     this.streamName = streamName;
     this.streamNumber = streamNumber;
     this.typeDesc = typeDesc;
     this.hasPunctuation = hasPunctuation;
 }