Esempio n. 1
0
        /// <summary>
        /// Output (emitter) added to element.
        /// </summary>
        /// <remarks>Called just after element start (or dynamically if added once pipeline running).</remarks>
        /// <param name="pipeline">Pipeline to which the element belongs.</param>
        /// <param name="element">Element to which emitter is being added.</param>
        /// <param name="emitter">Emitter being added.</param>
        public void PipelineElementAddEmitter(Pipeline pipeline, PipelineElement element, IEmitter emitter)
        {
            var node   = this.graphs[pipeline.Id].PipelineElements[element.Id];
            var output = new PipelineDiagnosticsInternal.EmitterDiagnostics(emitter.Id, emitter.Name, emitter.Type.FullName, node);

            node.Emitters.TryAdd(output.Id, output);
            if (!this.outputs.TryAdd(output.Id, output))
            {
                throw new InvalidOperationException("Failed to add emitter/output");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmitterDiagnostics"/> class.
 /// </summary>
 /// <param name="emitterDiagnostics">Internal emitter diagnostics.</param>
 /// <param name="builder">Builder of pipeline parts used during construction.</param>
 internal EmitterDiagnostics(PipelineDiagnosticsInternal.EmitterDiagnostics emitterDiagnostics, Builder builder)
 {
     this.Id   = emitterDiagnostics.Id;
     this.Name = emitterDiagnostics.Name;
     this.Type = emitterDiagnostics.Type;
     builder.EnqueueThunk(() =>
     {
         if (builder.PipelineElements.TryGetValue(emitterDiagnostics.PipelineElement.Id, out var element))
         {
             this.PipelineElement = element;
         }
     });
     builder.EnqueueThunk(() => this.Targets = emitterDiagnostics.Targets.Values.Select(r => builder.Receivers.TryGetValue(r.Id, out var receiver) ? receiver : null).Where(r => r != null).ToArray());
 }
Esempio n. 3
0
 /// <summary>
 /// Get or create external emitter diagnostics representation.
 /// </summary>
 /// <param name="emitterDiagnosticsInternal">Internal pipeline element diagnostics representation.</param>
 /// <returns>External pipeline element diagnostics representation.</returns>
 public EmitterDiagnostics GetOrCreateEmitterDiagnostics(PipelineDiagnosticsInternal.EmitterDiagnostics emitterDiagnosticsInternal)
 {
     return(this.GetOrCreate(this.Emitters, emitterDiagnosticsInternal, e => e.Id, (e, c) => new EmitterDiagnostics(e, c)));
 }