20 using System.Collections;
23 using System.Collections.Generic;
33 private readonly
Symbol _requestedSymbol;
35 private IEnumerator<BaseData> _previousEnumerator;
36 private IEnumerator<BaseData> _underlyingEnumerator;
46 object IEnumerator.Current =>
Current;
53 _requestedSymbol = dataConfig.
Symbol;
54 _underlyingEnumerator = dataQueueHandler.SubscribeWithMapping(dataConfig, handler, isExpired, out _currentConfig);
60 _previousEnumerator = _underlyingEnumerator;
62 var oldSymbol = _currentConfig.Symbol;
63 _underlyingEnumerator = dataQueueHandler.SubscribeWithMapping(dataConfig, handler, isExpired, out _currentConfig);
65 Log.
Trace($
"LiveSubscriptionEnumerator({_requestedSymbol}): " +
66 $
"resubscribing old: '{oldSymbol.Value}' new '{_currentConfig.Symbol.Value}'");
75 if (_previousEnumerator !=
null)
78 _previousEnumerator.DisposeSafely();
79 _previousEnumerator =
null;
82 var result = _underlyingEnumerator.MoveNext();
85 _current = _underlyingEnumerator.Current;
92 if (_current !=
null && _current.
Symbol != _requestedSymbol)
96 _current = _current.
Clone();
97 _current.
Symbol = _requestedSymbol;
108 _underlyingEnumerator.Reset();
116 _previousEnumerator.DisposeSafely();
117 _underlyingEnumerator.DisposeSafely();