Ejemplo n.º 1
0
 public bool Contains(TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         return(m_TimeSpanBuffer.Contains(item));
     }
 }
Ejemplo n.º 2
0
 public bool Remove(TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         return(m_TimeSpanBuffer.Remove(item));
     }
 }
Ejemplo n.º 3
0
 public void Insert(int index, TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         m_TimeSpanBuffer.Insert(index, item);
     }
 }
Ejemplo n.º 4
0
 public void Add(TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         m_TimeSpanBuffer.Add(item);
     }
 }
Ejemplo n.º 5
0
 public int IndexOf(TimeStampedValue <T> item)
 {
     lock (this.SyncObject)
     {
         return(m_TimeSpanBuffer.IndexOf(item));
     }
 }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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());
            }
        }
Ejemplo n.º 9
0
 public virtual void Insert(int index, TimeStampedValue <T> item)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 10
0
 public virtual int IndexOf(TimeStampedValue <T> item)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 11
0
 protected virtual void OnOldEntryRemoved(TimeStampedValue <T> removedValue)
 {
 }
Ejemplo n.º 12
0
 public virtual bool Remove(TimeStampedValue <T> item)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 13
0
 public virtual bool Contains(TimeStampedValue <T> item)
 {
     throw new NotImplementedException();
 }