Пример #1
0
        /// <summary>
        /// Process the tick; add to the con
        /// </summary>
        /// <param name="data"></param>
        public void Process(Tick data)
        {
            if (data.TickType != _tickType)
            {
                return;
            }

            _consolidator.Update(data);
        }
Пример #2
0
 public SequentialConsolidator(IDataConsolidator first, IDataConsolidator second)
 {
     if (!second.InputType.IsAssignableFrom(first.OutputType))
     {
         throw new ArgumentException("first.OutputType must equal second.OutputType!");
     }
     First  = first;
     Second = second;
     first.DataConsolidated  += (sender, consolidated) => second.Update(consolidated);
     second.DataConsolidated += (sender, consolidated) => OnDataConsolidated(consolidated);
 }
Пример #3
0
        /// <summary>
        /// Updates the consolidator
        /// </summary>
        /// <param name="data">The data to consolidate</param>
        public void Update(T data)
        {
            // if the input type of the consolidator isn't generic we validate it's correct before sending it in
            if (_validateInputType && data.GetType() != _consolidatorInputType)
            {
                return;
            }

            if (_isPeriodBase)
            {
                // we only need to lock if it's period base since the move next call could trigger a scan
                lock (_consolidator)
                {
                    _consolidator.Update(data);
                }
            }
            else
            {
                _consolidator.Update(data);
            }
        }
Пример #4
0
        /// <summary>
        ///      Creates a new consolidator that will pump date through the first, and then the output
        ///      of the first into the second. This enables 'wrapping' or 'composing' of consolidators
        /// </summary>
        /// <param name="first">The first consolidator to receive data</param>
        /// <param name="second">The consolidator to receive first's output</param>
        public SequentialConsolidator(IDataConsolidator first, IDataConsolidator second, string name = "")
        {
            First  = first;
            Second = second;
            Name   = name;
            // wire up the second one to get data from the first
            first.Updated += (time, updated) => second.Update(time, updated);

            // wire up the second one's events to also fire this consolidator's event so consumers
            // can attach
            second.Updated += (time, updated) => OnDataConsolidated(time, updated);
        }
Пример #5
0
        /// <summary>
        /// Creates a new consolidator that will pump date through the first, and then the output
        /// of the first into the second. This enables 'wrapping' or 'composing' of consolidators
        /// </summary>
        /// <param name="first">The first consolidator to receive data</param>
        /// <param name="second">The consolidator to receive first's output</param>
        public SequentialConsolidator(IDataConsolidator first, IDataConsolidator second)
        {
            if (first.OutputType != second.InputType)
            {
                throw new ArgumentException("first.OutputType must equal second.OutputType!");
            }
            First  = first;
            Second = second;

            // wire up the second one to get data from the first
            first.DataConsolidated += (sender, consolidated) => second.Update(consolidated);
        }
Пример #6
0
        /// <summary>
        /// Creates a new consolidator that will pump date through the first, and then the output
        /// of the first into the second. This enables 'wrapping' or 'composing' of consolidators
        /// </summary>
        /// <param name="first">The first consolidator to receive data</param>
        /// <param name="second">The consolidator to receive first's output</param>
        public SequentialConsolidator(IDataConsolidator first, IDataConsolidator second)
        {
            if (!second.InputType.IsAssignableFrom(first.OutputType))
            {
                throw new ArgumentException("first.OutputType must equal second.OutputType!");
            }
            First  = first;
            Second = second;

            // wire up the second one to get data from the first
            first.DataConsolidated += (sender, consolidated) => second.Update(consolidated);

            // wire up the second one's events to also fire this consolidator's event so consumers
            // can attach
            second.DataConsolidated += (sender, consolidated) => OnDataConsolidated(consolidated);
        }
Пример #7
0
        /// <summary>
        /// Creates a new consolidator that will pump date through the first, and then the output
        /// of the first into the second. This enables 'wrapping' or 'composing' of consolidators
        /// </summary>
        /// <param name="first">The first consolidator to receive data</param>
        /// <param name="second">The consolidator to receive first's output</param>
        public SequentialConsolidator(IDataConsolidator first, IDataConsolidator second)
        {
            if (first.OutputType != second.InputType)
            {
                throw new ArgumentException("first.OutputType must equal second.OutputType!");
            }
            First = first;
            Second = second;

            // wire up the second one to get data from the first
            first.DataConsolidated += (sender, consolidated) => second.Update(consolidated);

            // wire up the second one's events to also fire this consolidator's event so consumers
            // can attach
            second.DataConsolidated += (sender, consolidated) => OnDataConsolidated(consolidated);
        }