public void AddProcessor(LambdaExpression processor, NameType nameOut, params NameType[] nameIn) { if (_state != 0) { throw new InvalidOperationException(); } if (nameIn == null) { throw new ArgumentNullException(); } if (!nameOut.IsValid) { throw new ArgumentException(); } if (processor == null) { throw new ArgumentNullException(); } if (processor.ReturnType == typeof(void)) { throw new ArgumentException(); } if (nameIn.Length != processor.Parameters.Count()) { throw new ArgumentException(); } if (nameIn.Length == 0) { throw new ArgumentException(); } var maybeType = nameOut.Type.ToMaybe(); if (processor.ReturnType != nameOut.Type && processor.ReturnType != maybeType) { throw new ArgumentException(); } var nout = Get(nameOut); // check that no parameters have multiple inputs if (nout.SourceWriter != null) { throw new InvalidOperationException(); } if (nout.SourceProcessor != null) { throw new InvalidOperationException(); } if (Log.IsInfo) { Log.Info($"AddProcessor: {nameOut} - {string.Join(", ", nameIn)}"); } if (Log.IsVerbose) { Log.Verbose("Expression", processor); } var ns = nameIn.Select(Get).ToArray(); var ni = new ProcessorInfo(processor, ns, nout); _nodes.Add(ni); nout.SourceProcessor = ni; foreach (var n in ns) { n.Consumers.Add(ni); } }