Example #1
0
        public ITemporalStream AddTemporalQueue <T>(string token, string description = null)
        {
            ITemporalStream stream = m_streams.GetOrAdd(token,
                                                        _token =>
            {
                stream              = new TemporalQueue <T>(description);
                stream.NoObservers += () =>
                {
                    ITemporalStream forNull;
                    m_streams.TryRemove(token, out forNull);
                };
                return(stream);
            });

            return(stream);
        }
Example #2
0
        public IDisposable AddTemporalQueueObserver <T>(ITemporalObserver <T> observer, string token, string description = null,
                                                        int priority = TemporalContextManager.NewTokenPriority)
        {
            ITemporalStream stream = m_streams.GetOrAdd(token,
                                                        _token =>
            {
                stream              = new TemporalQueue <T>(description);
                stream.NoObservers += () =>
                {
                    ITemporalStream forNull;
                    m_streams.TryRemove(token, out forNull);
                };
                return(stream);
            });

            TemporalContext <T> ctx = new TemporalContext <T>((ITemporalValueSource <T>)stream, observer, priority);

            return(stream.Subscribe(new TemporalContextHelper <T>(ctx, this)));
        }
Example #3
0
 public Unsubscriber(ITemporalObserver <Td> observer, TemporalQueue <Td> queue)
 {
     m_observer = observer;
     m_queue    = queue;
 }