public static CreateObservationRecord ( GSF.PQDIF.Physical.Record physicalRecord, |
||
physicalRecord | GSF.PQDIF.Physical.Record | The physical record used to create the observation record. |
dataSource | The data source record that defines the channels in this observation record. | |
settings | GSF.PQDIF.Logical.MonitorSettingsRecord | The monitor settings to be applied to this observation record. |
리턴 |
public static ObservationRecord CreateObservationRecord(Record physicalRecord, DataSourceRecord dataSource, MonitorSettingsRecord settings)
{
bool isValidObservationRecord = physicalRecord.Header.TypeOfRecord == RecordType.Observation;
return isValidObservationRecord ? new ObservationRecord(physicalRecord, dataSource, settings) : null;
}
/// <summary> /// Determines whether there are any more /// <see cref="ObservationRecord"/>s to be /// read from the PQDIF file. /// </summary> /// <returns>true if there is another observation record to be read from PQDIF file; false otherwise</returns> public bool HasNextObservationRecord() { Record physicalRecord; RecordType recordType; // Read records from the file until we encounter an observation record or end of file while ((object)m_nextObservationRecord == null && m_physicalParser.HasNextRecord()) { physicalRecord = m_physicalParser.NextRecord(); recordType = physicalRecord.Header.TypeOfRecord; switch (recordType) { case RecordType.DataSource: // Keep track of the latest data source record in order to associate it with observation records m_currentDataSourceRecord = DataSourceRecord.CreateDataSourceRecord(physicalRecord); m_allDataSourceRecords.Add(m_currentDataSourceRecord); break; case RecordType.MonitorSettings: // Keep track of the latest monitor settings record in order to associate it with observation records m_currentMonitorSettingsRecord = MonitorSettingsRecord.CreateMonitorSettingsRecord(physicalRecord); break; case RecordType.Observation: // Found an observation record! m_nextObservationRecord = ObservationRecord.CreateObservationRecord(physicalRecord, m_currentDataSourceRecord, m_currentMonitorSettingsRecord); break; case RecordType.Container: // The container record is parsed when the file is opened; it should never be encountered here throw new InvalidOperationException("Found more than one container record in PQDIF file."); default: // Ignore unrecognized record types as the rest of the file might be valid. //throw new ArgumentOutOfRangeException(string.Format("Unknown record type: {0}", physicalRecord.Header.RecordTypeTag)); break; } } return((object)m_nextObservationRecord != null); }