Opc.Ua.Server.AggregateManager.CreateCalculator C# (CSharp) Method

CreateCalculator() public method

Creates a new aggregate calculator.
public CreateCalculator ( NodeId aggregateId, System.DateTime startTime, System.DateTime endTime, double processingInterval, bool stepped, AggregateConfiguration configuration ) : IAggregateCalculator
aggregateId NodeId The id of the aggregate function.
startTime System.DateTime When to start processing.
endTime System.DateTime When to stop processing.
processingInterval double The processing interval.
stepped bool Whether stepped interpolation should be used.
configuration AggregateConfiguration The configuaration to use.
return IAggregateCalculator
        public IAggregateCalculator CreateCalculator(
            NodeId aggregateId,
            DateTime startTime,
            DateTime endTime,
            double processingInterval,
            bool stepped,
            AggregateConfiguration configuration)
        {
            if (NodeId.IsNull(aggregateId))
            {
                return null;
            }

            AggregatorFactory factory = null;

            lock (m_lock)
            {
                if (!m_factories.TryGetValue(aggregateId, out factory))
                {
                    return null;
                }
            }

            if (configuration.UseServerCapabilitiesDefaults)
            {
                configuration = m_defaultConfiguration;
            }

            IAggregateCalculator calculator = factory(aggregateId, startTime, endTime, processingInterval, stepped, configuration);

            if (calculator == null)
            {
                return null;
            }

            return calculator;
        }