public static IObservable <TOutput> OfType <TInput, TOutput>( this IObservable <TInput> source, params ITypeMap <TInput>[] typeMaps) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (typeMaps == null) { throw new ArgumentNullException(nameof(typeMaps)); } return(Observable .Create <Timestamped <object> >(observer => { var deserialzier = new CompositeDeserializer <TInput>(observer, typeMaps); deserialzier.EndTime = DateTime.MaxValue; deserialzier.AddKnownType(typeof(TOutput)); return source.SubscribeSafe(deserialzier); }) .Select(i => i.Value) .Where(i => i != null) .OfType <TOutput>()); }
public InputStream( Expression <Func <IObservable <TInput> > > createInput, DateTime startTime, DateTime endTime, params Type[] typeMaps) { _source = createInput.Compile()(); _output = new BufferQueue <Timestamped <object> >(); _deserializer = new CompositeDeserializer <TInput>(_output, typeMaps); }