private void Initialize() { ReadOnlyCollection <Processor> processors = this.Pipeline.Processors; int numberOfProcessors = processors.Count; this.ProcessorValueInfos = new ProcessorValueInfo[numberOfProcessors]; this.TotalInputValueCount = 0; // First pass -- compute all the input value information for each processor for (int processorIndex = 0; processorIndex < processors.Count; ++processorIndex) { Processor processor = processors[processorIndex]; int numberOfInputs = processor.InArguments.Count; ProcessorValueInfo valueInfo = new ProcessorValueInfo() { InputValueCount = numberOfInputs, InputValueOffset = this.TotalInputValueCount }; this.ProcessorValueInfos[processorIndex] = valueInfo; this.TotalInputValueCount += numberOfInputs; } // Second pass -- compute all the output value information (uses input value info above) for (int processorIndex = 0; processorIndex < processors.Count; ++processorIndex) { Processor processor = processors[processorIndex]; this.ProcessorValueInfos[processorIndex].OutputValueInfos = this.CreateOutputValueInfos(processor); } }
/// <summary> /// Retrieves information about the input values for the given processor. /// </summary> /// <param name="processorIndex">The 0-based index of the processor in this context.</param> /// <param name="inputValueOffset">The out parameter to receive the offset in the pool of input values /// where the input values for this processor start. They are contiguous.</param> /// <returns>The number of input values for this processor.</returns> public int GetInputValueInfo(int processorIndex, out int inputValueOffset) { Debug.Assert(processorIndex >= 0 && processorIndex < this.ProcessorValueInfos.Length, "processorIndex out of bounds"); ProcessorValueInfo info = this.ProcessorValueInfos[processorIndex]; inputValueOffset = info.InputValueOffset; return(info.InputValueCount); }
private void Initialize() { ReadOnlyCollection<Processor> processors = this.Pipeline.Processors; int numberOfProcessors = processors.Count; this.ProcessorValueInfos = new ProcessorValueInfo[numberOfProcessors]; this.TotalInputValueCount = 0; // First pass -- compute all the input value information for each processor for (int processorIndex = 0; processorIndex < processors.Count; ++processorIndex) { Processor processor = processors[processorIndex]; int numberOfInputs = processor.InArguments.Count; ProcessorValueInfo valueInfo = new ProcessorValueInfo() { InputValueCount = numberOfInputs, InputValueOffset = this.TotalInputValueCount }; this.ProcessorValueInfos[processorIndex] = valueInfo; this.TotalInputValueCount += numberOfInputs; } // Second pass -- compute all the output value information (uses input value info above) for (int processorIndex = 0; processorIndex < processors.Count; ++processorIndex) { Processor processor = processors[processorIndex]; this.ProcessorValueInfos[processorIndex].OutputValueInfos = this.CreateOutputValueInfos(processor); } }