Ejemplo n.º 1
0
 public static Pipe GetOrAdd(IPipeable p)
 {
     if (_pipes.ContainsKey(p))
     {
         return(_pipes[p]);
     }
     else
     {
         _pipes.Add(p, new GenericPipeline());
         return(_pipes[p]);
     }
 }
Ejemplo n.º 2
0
        public void Connect(IPipeable other, bool mirror)
        {
            //Logger.Log("Connecting {0} to {1} with mirror={2}", this, other, mirror);
            BlockingCollection <object> output;

            if (mirror)
            {
                output = new BlockingCollection <object>(DEFAULT_BUFFER_SIZE);
                allOutputs.Add(output);
            }
            else
            {
                Logger.Warning("Possible race condition: {0}.Connect({1}, {2}) was called.  This can result in one Pipeable leeching on another.", this, other, mirror);
                if (allOutputs.Count == 0)
                {
                    allOutputs.Add(new BlockingCollection <object>(DEFAULT_BUFFER_SIZE));
                }
                output = allOutputs[0];
            }
            other.SetInput(output);
        }
Ejemplo n.º 3
0
 public void Connect(IPipeable other)
 {
     Connect(other, false);
 }
Ejemplo n.º 4
0
        public static void Use(this IPipeable pipe, IFilter filter)
        {
            var p = PipeStorage.GetOrAdd(pipe);

            p.Register(filter);
        }
Ejemplo n.º 5
0
        public static void ExecutePipe(this IPipeable pipe, object input)
        {
            var p = PipeStorage.GetOrAdd(pipe);

            p.Process(input);
        }