public static TemporalLinker Create <T>(TemporalStream <T> stream, ITemporalObserver <T> observer) { return(new TemporalLinker(stream, observer, stream.TimeFrame, () => observer.Reset(), (time) => { TemporalValue <T> value; if (stream.TryGetValue(time, out value)) { observer.Apply(value); return true; } return false; })); }
public IDisposable Subscribe(object obj) { ITemporalObserver <T> observer = (ITemporalObserver <T>)obj; m_observers.GetOrAdd(observer, _ => { foreach (var v in m_values) { observer.Apply(new TemporalValue <T>(v.Key, v.Value)); } return(0); }); return(new Unsubscriber <T>(observer, this)); }