17 using System.Collections.Generic;
29 private DateTime _frontier;
31 private readonly Func<IBaseData, IDataConsolidator> _createConsolidator;
32 private readonly Dictionary<Symbol, IDataConsolidator> _consolidators;
41 _destination = destination;
42 _createConsolidator = createConsolidator;
43 _consolidators =
new Dictionary<Symbol, IDataConsolidator>();
54 if (!_consolidators.TryGetValue(data.
Symbol, out consolidator))
56 consolidator = _createConsolidator(data);
57 consolidator.DataConsolidated += OnDataConsolidated;
58 _consolidators[data.
Symbol] = consolidator;
61 consolidator.Update(data);
69 _frontier = DateTime.MaxValue;
72 foreach (var consolidator
in _consolidators.Values)
74 consolidator.Scan(_frontier);
77 _destination.Dispose();
78 _consolidators.Clear();
84 private void OnDataConsolidated(
object sender,
IBaseData args)
86 _destination.Process(args);
89 if (_frontier >= args.
EndTime)
return;
93 foreach (var consolidator
in _consolidators.Values)
97 consolidator.Scan(args.
EndTime.AddTicks(-1));