internal ImmediateMeasurements(ConcentratorBase parent) { m_parent = parent; m_parent.LagTimeUpdated += m_parent_LagTimeUpdated; m_parent.LeadTimeUpdated += m_parent_LeadTimeUpdated; m_measurements = new Dictionary<MeasurementKey, TemporalMeasurement>(); m_taggedMeasurements = new Dictionary<string, List<MeasurementKey>>(); }
private bool m_disposed; // Object disposed flag #endregion #region [ Constructors ] /// <summary> /// Creates a new <see cref="FrameQueue"/>. /// </summary> /// <param name="parent">Reference to parent concentrator instance.</param> internal FrameQueue(ConcentratorBase parent) { // Calculate initial dictionary capacity based on concentrator specifications int initialCapacity = (int)((1.0D + parent.LagTime + parent.LeadTime) * parent.FramesPerSecond); m_parent = parent; m_frameList = new LinkedList<IFrame>(); m_frameHash = new Dictionary<Ticks, IFrame>(initialCapacity); m_ticksPerFrame = parent.TicksPerFrame; }
/// <summary> /// Releases the unmanaged resources used by the <see cref="ImmediateMeasurements"/> object and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (!m_disposed) { try { if (disposing) { if (m_parent != null) { m_parent.LagTimeUpdated -= m_parent_LagTimeUpdated; m_parent.LeadTimeUpdated -= m_parent_LeadTimeUpdated; } m_parent = null; if (m_measurements != null) { m_measurements.Clear(); } m_measurements = null; if (m_taggedMeasurements != null) { m_taggedMeasurements.Clear(); } m_taggedMeasurements = null; } } finally { m_disposed = true; // Prevent duplicate dispose. } } }
/// <summary> /// Releases the unmanaged resources used by the <see cref="FrameQueue"/> object and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (!m_disposed) { try { if (disposing) { if (m_frameList != null) m_frameList.Clear(); m_frameList = null; if (m_frameHash != null) m_frameHash.Clear(); m_frameHash = null; m_parent = null; m_head = null; m_last = null; } } finally { m_disposed = true; // Prevent duplicate dispose. } } }