Click or drag to resize

LogicalParser Class

Represents a parser which parses the logical structure of a PQDIF file.
Inheritance Hierarchy
SystemObject
  GSF.PQDIF.LogicalLogicalParser

Namespace: GSF.PQDIF.Logical
Assembly: GSF.PQDIF (in GSF.PQDIF.dll) Version: 2.4.207-beta
Syntax
public class LogicalParser : IDisposable
View Source

The LogicalParser type exposes the following members.

Constructors
 NameDescription
Public methodLogicalParser(String) Creates a new instance of the LogicalParser class.
Public methodLogicalParser(Stream, Boolean) Creates a new instance of the LogicalParser class.
Top
Properties
 NameDescription
Public propertyContainerRecord Gets the container record from the PQDIF file. This is parsed as soon as the parser is Opened.
Public propertyDataSourceRecords Gets a list of all DataSource records from the PQDIF file. This is parsed when passing throug the observation records NextObservationRecorded.
Public propertyFileNameObsolete.
Gets or sets the file path (not just the name) of the PQDIF file to be parsed. Obsolete in favor of FilePath.
Public propertyFilePath Gets or sets the file path of the PQDIF file to be parsed.
Top
Methods
 NameDescription
Public methodClose Closes the PQDIF file.
Public methodDispose Releases resources held by the parser.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodHasNextObservationRecord Determines whether there are any more ObservationRecords to be read from the PQDIF file.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodNextObservationRecord Gets the next observation record from the PQDIF file.
Public methodOpen Opens the parser and parses the ContainerRecord.
Public methodOpen(Stream, Boolean) Opens the parser and parses the ContainerRecord.
Public methodReset Resets the parser to the beginning of the PQDIF file.
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks

This class makes the data from PQD files readily available to applications and defines several redundant properties throughout the logical hierarchy of the PQDIF file to also facilitate the association of definitions with instances within the logical structure. The following list enumerates some of the more useful associations within the hierarchy.

Usage consists of iterating through observations (ObservationRecord) to examine each of the the measurements recorded in the file. As was noted in the list above, the data source (DataSourceRecord) and settings for the monitor (MonitorSettingsRecord) associated with each observation is exposed as a property on the observation record. Note that the same data source and monitor settings records may be referenced by multiple observation records in the file.

The following example demonstrates how to read all observation records from a PQDIF file using the logical parser.

C#
ContainerRecord containerRecord;
List<ObservationRecord> observationRecords = new List<ObservationRecord>();
string fileName = args[0];

using (LogicalParser parser = new LogicalParser(fileName))
{
    parser.Open();
    containerRecord = parser.ContainerRecord;

    while (parser.HasNextObservationRecord())
        observationRecords.Add(parser.NextObservationRecord());
}
See Also