예제 #1
0
        public BlockContainerMerger(BlockContainer <T1, T2> b1, BlockContainer <T2, T3> b2) : base(BlockContainerOptions.Default)
        {
            m_b1 = b1;
            m_b2 = b2;

            m_b1.LinkTo(m_b2);

            RegisterChild(m_b1);
            RegisterChild(m_b2);
        }
예제 #2
0
        public static BlockContainer <TIn, TOut> AutoComplete <TIn, TOut>(this BlockContainer <TIn, TOut> blockContainer, TimeSpan timeout)
            where TIn : ITracableItem
            where TOut : ITracableItem
        {
            var autoCompletePair = new AutoCompleteContainerPair <TIn, TOut>(timeout);

            var merged = new BlockContainerMerger <TIn, TIn, TOut, TOut>(
                autoCompletePair.Before,
                blockContainer,
                autoCompletePair.After);

            return(merged);
        }
예제 #3
0
        protected void RegisterChild(BlockContainer childContainer, Action <Task> containerCompletionCallback = null)
        {
            if (childContainer == null)
            {
                throw new ArgumentNullException("childContainer");
            }

            if (m_children.OfType <BlockContainerMeta>().Any(cm => cm.Container.Equals(childContainer)))
            {
                throw new ArgumentException("Duplicate block container registered in " + this.Name);
            }

            m_children = m_children.Add(new BlockContainerMeta(childContainer, this, containerCompletionCallback));
        }
예제 #4
0
 protected ChildMetaBase(BlockContainer host, Action <Task> completionCallback)
 {
     m_host = host;
     m_completionCallback = completionCallback;
 }
예제 #5
0
 public BlockContainerMeta(BlockContainer childContainer, BlockContainer host, Action <Task> completionCallback = null) : base(host, completionCallback)
 {
     m_childContainer = childContainer;
     m_completion     = GetWrappedCompletion(m_childContainer.CompletionTask);
 }
예제 #6
0
 public BlockMeta(IDataflowBlock block, BlockContainer host, Action <Task> completionCallback = null) : base(host, completionCallback)
 {
     m_block      = block;
     m_completion = GetWrappedCompletion(m_block.Completion);
 }