Exemple #1
0
        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);
        }
Exemple #2
0
        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();
        }
Exemple #4
0
 public void AddRelay(ISeriesProcessor series)
 {
     RelayProcesses.Add(series);
 }