Exemple #1
0
		public BroadcastBlock (Func<T, T> cloner, DataflowBlockOptions dataflowBlockOptions)
		{
			if (dataflowBlockOptions == null)
				throw new ArgumentNullException ("dataflowBlockOptions");

			this.cloner = cloner;
			this.dataflowBlockOptions = dataflowBlockOptions;
			this.messageBox = new PassingMessageBox<T> (messageQueue, compHelper, () => outgoing.IsCompleted, BroadcastProcess, dataflowBlockOptions);
			this.outgoing = new MessageOutgoingQueue<T> (compHelper, () => messageQueue.IsCompleted);
			this.vault = new MessageVault<T> ();
		}
Exemple #2
0
        public JoinBlock(GroupingDataflowBlockOptions dataflowBlockOptions)
        {
            if (dataflowBlockOptions == null)
            {
                throw new ArgumentNullException("dataflowBlockOptions");
            }

            this.dataflowBlockOptions = dataflowBlockOptions;
            this.target1  = new JoinTarget <T1> (this, SignalArrivalTarget1, new BlockingCollection <T1> (), compHelper);
            this.target2  = new JoinTarget <T2> (this, SignalArrivalTarget2, new BlockingCollection <T2> (), compHelper);
            this.outgoing = new MessageOutgoingQueue <Tuple <T1, T2> > (compHelper, () => target1.Buffer.IsCompleted || target2.Buffer.IsCompleted);
        }
Exemple #3
0
        public BufferBlock(DataflowBlockOptions dataflowBlockOptions)
        {
            if (dataflowBlockOptions == null)
            {
                throw new ArgumentNullException("dataflowBlockOptions");
            }

            this.dataflowBlockOptions = dataflowBlockOptions;
            this.messageBox           = new PassingMessageBox <T> (messageQueue, compHelper, () => outgoing.IsCompleted, ProcessQueue, dataflowBlockOptions);
            this.outgoing             = new MessageOutgoingQueue <T> (compHelper, () => messageQueue.IsCompleted);
            this.vault = new MessageVault <T> ();
        }
Exemple #4
0
        public BatchBlock(int batchSize, DataflowBlockOptions dataflowBlockOptions)
        {
            if (dataflowBlockOptions == null)
            {
                throw new ArgumentNullException("dataflowBlockOptions");
            }

            this.batchSize            = batchSize;
            this.dataflowBlockOptions = dataflowBlockOptions;
            this.messageBox           = new PassingMessageBox <T> (messageQueue, compHelper, () => outgoing.IsCompleted, BatchProcess, dataflowBlockOptions);
            this.outgoing             = new MessageOutgoingQueue <T[]> (compHelper, () => messageQueue.IsCompleted);
            this.vault = new MessageVault <T[]> ();
        }
Exemple #5
0
        public TransformBlock(Func <TInput, TOutput> transformer, ExecutionDataflowBlockOptions dataflowBlockOptions)
        {
            if (dataflowBlockOptions == null)
            {
                throw new ArgumentNullException("dataflowBlockOptions");
            }

            this.transformer          = transformer;
            this.dataflowBlockOptions = dataflowBlockOptions;
            this.messageBox           = new ExecutingMessageBox <TInput> (messageQueue,
                                                                          compHelper,
                                                                          () => outgoing.IsCompleted,
                                                                          TransformProcess,
                                                                          dataflowBlockOptions);
            this.outgoing = new MessageOutgoingQueue <TOutput> (compHelper, () => messageQueue.IsCompleted);
            this.vault    = new MessageVault <TOutput> ();
        }
Exemple #6
0
        public JoinBlock(GroupingDataflowBlockOptions dataflowBlockOptions)
        {
            if (dataflowBlockOptions == null)
            {
                throw new ArgumentNullException("dataflowBlockOptions");
            }

            this.dataflowBlockOptions = dataflowBlockOptions;

            Func <bool> checker1 = () => target2.Buffer.Count == 0 || target3.Buffer.Count == 0;
            Func <bool> checker2 = () => target1.Buffer.Count == 0 || target3.Buffer.Count == 0;
            Func <bool> checker3 = () => target1.Buffer.Count == 0 || target2.Buffer.Count == 0;

            this.target1  = new JoinTarget <T1> (this, () => SignalArrivalTargetImpl(checker1), new BlockingCollection <T1> (), compHelper);
            this.target2  = new JoinTarget <T2> (this, () => SignalArrivalTargetImpl(checker2), new BlockingCollection <T2> (), compHelper);
            this.target3  = new JoinTarget <T3> (this, () => SignalArrivalTargetImpl(checker3), new BlockingCollection <T3> (), compHelper);
            this.outgoing =
                new MessageOutgoingQueue <Tuple <T1, T2, T3> > (compHelper,
                                                                () => target1.Buffer.IsCompleted || target2.Buffer.IsCompleted || target3.Buffer.IsCompleted);
        }