public virtual void AssignDataSources(ISeriesProcessor processor) { var dataSource = _publisherContainer.GetDataSource(processor); dataSource.AddSubscriber(processor); // var subscribingTo = _typeFinder.GetGenericImplementations<IDataSubscriber>(processor); // var implementations = _typeFinder.GetImplementations<IDataSubscribable>(subscribingTo, // // foreach (var impl in implementations) // impl.AddSubscriber(processor); }
public virtual void AssignDataSources(ISeriesProcessor processor) { if (processor.HasDataSource) { return; } var subscribingTo = _typeFinder.GetGenericImplementations <IDataSubscriber>(processor); var implementations = _typeFinder.GetImplementations <IDataSubscribable>( subscribingTo, GetAll()); foreach (var impl in implementations) { impl.AddSubscriber(processor); } }
public void AddToCappedChainTerminator <TWorkerInput>( ISeriesProcessor <TWorkerInput> workSystem, Action <TWorkerInput> addData) { foreach (var o in GetFuncs()) { switch (o) { case Func <TInput, TWorkerInput> oneToOne: _connectedFuncs.Add(o); Action <TInput> newComposed = f => { addData(oneToOne(f)); if (workSystem.AvailableBuffer == 0) { workSystem.TryProcess(null); } }; _connectedFuncs.Add(newComposed); SetLastFunc(newComposed); return; case Func <TInput, IEnumerable <TWorkerInput> > oneToMany: Action <TInput> newComposed2 = (f) => { foreach (var v in oneToMany(f)) { addData(v); if (workSystem.AvailableBuffer == 0) { workSystem.TryProcess(null); } } }; _connectedFuncs.Add(o); _connectedFuncs.Add(newComposed2); SetLastFunc(newComposed2); return; } } throw new InvalidDataContractException(); }
public void AddRelay(ISeriesProcessor series) { RelayProcesses.Add(series); }