public static Pipe GetOrAdd(IPipeable p) { if (_pipes.ContainsKey(p)) { return(_pipes[p]); } else { _pipes.Add(p, new GenericPipeline()); return(_pipes[p]); } }
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); }
public void Connect(IPipeable other) { Connect(other, false); }
public static void Use(this IPipeable pipe, IFilter filter) { var p = PipeStorage.GetOrAdd(pipe); p.Register(filter); }
public static void ExecutePipe(this IPipeable pipe, object input) { var p = PipeStorage.GetOrAdd(pipe); p.Process(input); }