Пример #1
0
 protected override void ProcessRealTimeExport(Export export, DataListener listener, IList <IDataPoint> data)
 {
     throw new NotSupportedException();  // Real-Time exports not supported.
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RealTimeData"/> class.
 /// </summary>
 /// <param name="export">The <see cref="Export"/> to which the <paramref name="data"/> belongs.</param>
 /// <param name="listener">The <see cref="DataListener"/> that provided the <paramref name="data"/>.</param>
 /// <param name="data">The real-time time-series data received by the <paramref name="listener"/>.</param>
 public RealTimeData(Export export, DataListener listener, IList <IDataPoint> data)
 {
     this.Export   = export;
     this.Listener = listener;
     this.Data     = data;
 }
Пример #3
0
 /// <summary>
 /// When overridden in a derived class, processes the <paramref name="export"/> using the real-time <paramref name="data"/>.
 /// </summary>
 /// <param name="export"><see cref="Export"/> to be processed.</param>
 /// <param name="listener"><see cref="DataListener"/> that provided the <paramref name="data"/>.</param>
 /// <param name="data">Real-time time-series data received by the <paramref name="listener"/>.</param>
 protected abstract void ProcessRealTimeExport(Export export, DataListener listener, IList <IDataPoint> data);
Пример #4
0
        /// <summary>
        /// Returns the current time-series data for the specified <paramref name="export"/> organized by listener.
        /// </summary>
        /// <param name="export"><see cref="Export"/> whose current time-series data is to be returned.</param>
        /// <returns>A <see cref="Dictionary{TKey,TValue}"/> object where the <b>key</b> is the <see cref="DataListener.Name"/> and <b>value</b> is the time-series data.</returns>
        protected Dictionary <string, IList <IDataPoint> > GetExportData(Export export)
        {
            // Arrange all export records by listeners.
            Dictionary <string, IList <ExportRecord> > exportRecords = new Dictionary <string, IList <ExportRecord> >(StringComparer.CurrentCultureIgnoreCase);

            foreach (ExportRecord record in export.Records)
            {
                if (!exportRecords.ContainsKey(record.Instance))
                {
                    exportRecords.Add(record.Instance, new List <ExportRecord>());
                }

                exportRecords[record.Instance].Add(record);
            }

            // Gather time-series data for the export records.
            DataListener      listener;
            List <IDataPoint> listenerData = new List <IDataPoint>();
            Dictionary <string, IList <IDataPoint> > exportData = new Dictionary <string, IList <IDataPoint> >();

            foreach (string listenerName in exportRecords.Keys)
            {
                // Don't proceed if the listener doesn't exist.
                if ((listener = FindListener(listenerName)) == null)
                {
                    continue;
                }

                // Get a local copy of the listener's current data.
                listenerData.Clear();
                lock (listener.Data)
                {
                    listenerData.AddRange(listener.Data);
                }

                exportData.Add(listenerName, new List <IDataPoint>());
                if (exportRecords[listenerName].Count == 1 && exportRecords[listenerName][0].Identifier == -1)
                {
                    // Include all current data from the listener.
                    exportData[listenerName].AddRange(listenerData);
                }
                else
                {
                    // Specific records have been defined for this listener, so we'll gather data for those records.
                    foreach (ExportRecord record in exportRecords[listenerName])
                    {
                        if (record.Identifier <= listenerData.Count)
                        {
                            // Data does exist for the defined point.
                            exportData[listenerName].Add(listenerData[record.Identifier - 1]);
                        }
                        else
                        {
                            // Data does not exist for the point, so provide empty data.
                            exportData[listenerName].Add(new ArchiveDataPoint(record.Identifier));
                        }
                    }
                }
            }
            return(exportData);
        }
Пример #5
0
 /// <summary>
 /// When overridden in a derived class, processes the <paramref name="export"/> using the current <see cref="DataListener.Data"/>.
 /// </summary>
 /// <param name="export"><see cref="Export"/> to be processed.</param>
 protected abstract void ProcessExport(Export export);