Exemplo n.º 1
0
        public RuntimeMetricProxy(IRuntimeMetricManager manager, string metricName, Func <string, IRuntimeMetric> metricCreator)
        {
            if (string.IsNullOrWhiteSpace(metricName) || manager == null || metricCreator == null)
            {
                throw new ArgumentNullException();
            }

            _manager     = manager;
            _metricIndex = manager.RegisterMetric(metricName, metricCreator);
        }
Exemplo n.º 2
0
        public int RegisterMetric(IGroupRuntimeMetric metric)
        {
            if (metric == null)
            {
                throw new ArgumentNullException();
            }

            var dependedMetricIndices = metric.DependedRawMetrics
                                        .Select(s => _manager.RegisterMetric(s))
                                        .ToArray();

            _dependedMetrics.Add(dependedMetricIndices);

            var tradingObjectIndices = metric.TradingObjects
                                       .Select(t => t.Index)
                                       .ToArray();

            _tradingObjects.Add(tradingObjectIndices);

            _metrics.Add(metric);

            return(_metrics.Count - 1);
        }