Пример #1
0
 public bool Contains(TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         return(m_TimeSpanBuffer.Contains(item));
     }
 }
Пример #2
0
 public bool Remove(TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         return(m_TimeSpanBuffer.Remove(item));
     }
 }
Пример #3
0
 public void Insert(int index, TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         m_TimeSpanBuffer.Insert(index, item);
     }
 }
Пример #4
0
 public void Add(TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         m_TimeSpanBuffer.Add(item);
     }
 }
Пример #5
0
 public int IndexOf(TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         return(m_TimeSpanBuffer.IndexOf(item));
     }
 }
Пример #6
0
        public virtual void Add(TimeStampedValue <T> value)
        {
            RemoveOldEntries();
            m_DataBuffer[m_EndIndex] = value;
            m_EndIndex = (m_EndIndex + 1) % m_DataBuffer.Length;

            if (m_EndIndex == m_StartIndex)
            {
                IncreaseDataBuffer();
            }
        }
Пример #7
0
        private void IncreaseDataBuffer()
        {
            TimeStampedValue <T>[] newDataBuffer = new TimeStampedValue <T> [m_DataBuffer.Length + m_SizeIncrement];
            for (int i = 0; i < m_DataBuffer.Length; i++)
            {
                newDataBuffer[i] = this[i];
            }

            m_StartIndex = 0;
            m_EndIndex   = m_DataBuffer.Length;

            m_DataBuffer = newDataBuffer;
        }
Пример #8
0
        protected virtual void RemoveOldEntries()
        {
            DateTime now            = DateTime.Now;
            long     cutOffAgeTicks = now.Ticks - m_MaximalAge.Ticks;

            while (this.Count > 0 && m_DataBuffer[m_StartIndex].TimeStamp.Ticks < cutOffAgeTicks)
            {
                //Debug.WriteLine("Removing old entry, current count: " + this.Count);
                m_IsReady = true;                 // the buffer is full

                TimeStampedValue <T> removedValue = m_DataBuffer[m_StartIndex];
                m_StartIndex = (m_StartIndex + 1) % m_DataBuffer.Length;
                OnOldEntryRemoved(removedValue);
                //Debug.WriteLine("After removing old entry, current count: " + this.Count);
                //Debug.WriteLine("Age of next entry: " + new TimeSpan(now.Ticks - m_DataBuffer[m_StartIndex].TimeStamp.Ticks).TotalSeconds.ToString());
            }
        }
Пример #9
0
 public virtual void Insert(int index, TimeStampedValue <T> item)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Пример #10
0
 public virtual int IndexOf(TimeStampedValue <T> item)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Пример #11
0
 protected virtual void OnOldEntryRemoved(TimeStampedValue <T> removedValue)
 {
 }
Пример #12
0
 public virtual bool Remove(TimeStampedValue <T> item)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Пример #13
0
 public virtual bool Contains(TimeStampedValue <T> item)
 {
     throw new NotImplementedException();
 }