Esempio n. 1
0
        /// <summary>
        /// Links a dataflow to multiple targets. Uses DataBroadcaster internally.
        /// </summary>
        /// <typeparam name="TIn">The input type of the Dataflow</typeparam>
        /// <typeparam name="TOut">The output type of the Dataflow</typeparam>
        /// <param name="dataflow">The source dataflow</param>
        /// <param name="out1">The first target dataflow</param>
        /// <param name="out2">The second target dataflow</param>
        /// <param name="copyFunc">The copy function</param>
        public static void LinkToMultiple <TIn, TOut>(this Dataflow <TIn, TOut> dataflow, IDataflow <TOut> out1, IDataflow <TOut> out2, Func <TOut, TOut> copyFunc = null)
        {
            var brancher = new DataBroadcaster <TOut>(copyFunc, DataflowOptions.Default);

            dataflow.GoTo(brancher);
            brancher.LinkTo(out1);
            brancher.LinkTo(out2);
        }
Esempio n. 2
0
        public DataflowMerger(Dataflow <T1, T2> b1, Dataflow <T2, T3> b2, DataflowOptions options) : base(options)
        {
            m_b1 = b1;
            m_b2 = b2;

            m_b1.GoTo(m_b2);

            RegisterChild(m_b1);
            RegisterChild(m_b2);
        }
Esempio n. 3
0
        /// <summary>
        /// Links a dataflow to multiple targets. Uses DataBroadcaster internally.
        /// </summary>
        /// <typeparam name="TIn">The input type of the Dataflow</typeparam>
        /// <typeparam name="TOut">The output type of the Dataflow</typeparam>
        /// <param name="dataflow">The source dataflow</param>
        /// <param name="copyFunc">The copy function</param>
        /// <param name="outs">The target dataflows</param>
        public static void LinkToMultiple <TIn, TOut>(this Dataflow <TIn, TOut> dataflow, Func <TOut, TOut> copyFunc, params IDataflow <TOut>[] outs)
        {
            var brancher = new DataBroadcaster <TOut>(copyFunc, DataflowOptions.Default);

            dataflow.GoTo(brancher);

            foreach (var output in outs)
            {
                brancher.LinkTo(output);
            }
        }