C# 클래스 GSF.TimeSeries.Adapters.OutputAdapterBase

Represents the base class for any outgoing data stream.
This base class acts as a measurement queue so that output adapters can temporarily go offline without losing any measurements to be processed. Derived classes are expected to override ProcessMeasurements to handle queued measurements.
상속: AdapterBase, IOutputAdapter
파일 보기 프로젝트 열기: GridProtectionAlliance/gsf

Private Properties

프로퍼티 타입 설명
AttemptConnectionOperation void
RefreshMetadata void
m_connectionTimer_Elapsed void
m_measurementQueue_ProcessException void
m_monitorTimer_Elapsed void

공개 메소드들

메소드 설명
Flush ( ) : void

Blocks the current thread, if the OutputAdapterBase is connected, until all items in OutputAdapterBase queue are processed, and then stops processing.

It is possible for items to be added to the queue while the flush is executing. The flush will continue to process items as quickly as possible until the queue is empty. Unless the user stops queuing items to be processed, the flush call may never return (not a happy situation on shutdown).

The OutputAdapterBase does not clear queue prior to destruction. If the user fails to call this method before the class is destructed, there may be items that remain unprocessed in the queue.

Initialize ( ) : void

Initializes OutputAdapterBase.

QueueMeasurementForProcessing ( IMeasurement measurement ) : void

Queues a single measurement for processing. Measurement is automatically filtered to the defined IAdapter.InputMeasurementKeys.

QueueMeasurementsForProcessing ( IEnumerable measurements ) : void

Queues a collection of measurements for processing. Measurements are automatically filtered to the defined IAdapter.InputMeasurementKeys.

RemoveMeasurements ( int total ) : void

This removes a range of measurements from the internal measurement queue.

This method is typically only used to curtail size of measurement queue if it's getting too large. If more points are requested than there are points available - all points in the queue will be removed.

Start ( ) : void

Starts this OutputAdapterBase and initiates connection cycle to data output stream.

Stop ( ) : void

Stops this OutputAdapterBase and disconnects from data output stream.

보호된 메소드들

메소드 설명
AttemptConnection ( ) : void

Attempts to connect to data output stream.

Derived classes should attempt connection to data output stream here. Any exceptions thrown by this implementation will result in restart of the connection cycle.

AttemptDisconnection ( ) : void

Attempts to disconnect from data output stream.

Derived classes should attempt disconnect from data output stream here. Any exceptions thrown by this implementation will be reported to host via AdapterBase.ProcessException event.

Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the OutputAdapterBase object and optionally releases the managed resources.

ExecuteMetadataRefresh ( ) : void

Executes the metadata refresh in a synchronous fashion.

OnConnected ( ) : void

Called when data output source connection is established.

Derived classes should call this method manually if UseAsyncConnect is true.

OnDisconnected ( ) : void

Called when data input source is disconnected.

Derived classes should call this method manually if UseAsyncConnect is true.

OnUnprocessedMeasurements ( int unprocessedMeasurements ) : void

Raises the UnprocessedMeasurements event.

OutputAdapterBase ( ) : System

Constructs a new instance of the OutputAdapterBase.

ProcessMeasurements ( IMeasurement measurements ) : void

Serializes measurements to data output stream.

Derived classes must implement this function to process queued measurements. For example, this function would "archive" measurements if output adapter is for a historian.

It is important that consumers "resume" connection cycle if processing fails (e.g., connection to archive is lost). Here is an example: protected virtual void ProcessMeasurements(IMeasurement[] measurements) { try { // Process measurements... foreach (IMeasurement measurement in measurement) { ArchiveMeasurement(measurement); } } catch (Exception) { // So long as user hasn't requested to stop, restart connection cycle if (Enabled) Start(); } }

비공개 메소드들

메소드 설명
AttemptConnectionOperation ( ) : void
RefreshMetadata ( ) : void
m_connectionTimer_Elapsed ( object sender, EventArgs e ) : void
m_measurementQueue_ProcessException ( object sender, EventArgs e ) : void
m_monitorTimer_Elapsed ( object sender, EventArgs e ) : void

메소드 상세

AttemptConnection() 보호된 추상적인 메소드

Attempts to connect to data output stream.
Derived classes should attempt connection to data output stream here. Any exceptions thrown by this implementation will result in restart of the connection cycle.
protected abstract AttemptConnection ( ) : void
리턴 void

AttemptDisconnection() 보호된 추상적인 메소드

Attempts to disconnect from data output stream.
Derived classes should attempt disconnect from data output stream here. Any exceptions thrown by this implementation will be reported to host via AdapterBase.ProcessException event.
protected abstract AttemptDisconnection ( ) : void
리턴 void

Dispose() 보호된 메소드

Releases the unmanaged resources used by the OutputAdapterBase object and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
리턴 void

ExecuteMetadataRefresh() 보호된 메소드

Executes the metadata refresh in a synchronous fashion.
protected ExecuteMetadataRefresh ( ) : void
리턴 void

Flush() 공개 메소드

Blocks the current thread, if the OutputAdapterBase is connected, until all items in OutputAdapterBase queue are processed, and then stops processing.

It is possible for items to be added to the queue while the flush is executing. The flush will continue to process items as quickly as possible until the queue is empty. Unless the user stops queuing items to be processed, the flush call may never return (not a happy situation on shutdown).

The OutputAdapterBase does not clear queue prior to destruction. If the user fails to call this method before the class is destructed, there may be items that remain unprocessed in the queue.

public Flush ( ) : void
리턴 void

Initialize() 공개 메소드

Initializes OutputAdapterBase.
public Initialize ( ) : void
리턴 void

OnConnected() 보호된 메소드

Called when data output source connection is established.
Derived classes should call this method manually if UseAsyncConnect is true.
protected OnConnected ( ) : void
리턴 void

OnDisconnected() 보호된 메소드

Called when data input source is disconnected.
Derived classes should call this method manually if UseAsyncConnect is true.
protected OnDisconnected ( ) : void
리턴 void

OnUnprocessedMeasurements() 보호된 메소드

Raises the UnprocessedMeasurements event.
protected OnUnprocessedMeasurements ( int unprocessedMeasurements ) : void
unprocessedMeasurements int Total measurements in the queue that have not been processed.
리턴 void

OutputAdapterBase() 보호된 메소드

Constructs a new instance of the OutputAdapterBase.
protected OutputAdapterBase ( ) : System
리턴 System

ProcessMeasurements() 보호된 추상적인 메소드

Serializes measurements to data output stream.

Derived classes must implement this function to process queued measurements. For example, this function would "archive" measurements if output adapter is for a historian.

It is important that consumers "resume" connection cycle if processing fails (e.g., connection to archive is lost). Here is an example: protected virtual void ProcessMeasurements(IMeasurement[] measurements) { try { // Process measurements... foreach (IMeasurement measurement in measurement) { ArchiveMeasurement(measurement); } } catch (Exception) { // So long as user hasn't requested to stop, restart connection cycle if (Enabled) Start(); } }

protected abstract ProcessMeasurements ( IMeasurement measurements ) : void
measurements IMeasurement
리턴 void

QueueMeasurementForProcessing() 공개 메소드

Queues a single measurement for processing. Measurement is automatically filtered to the defined IAdapter.InputMeasurementKeys.
public QueueMeasurementForProcessing ( IMeasurement measurement ) : void
measurement IMeasurement Measurement to queue for processing.
리턴 void

QueueMeasurementsForProcessing() 공개 메소드

Queues a collection of measurements for processing. Measurements are automatically filtered to the defined IAdapter.InputMeasurementKeys.
public QueueMeasurementsForProcessing ( IEnumerable measurements ) : void
measurements IEnumerable Measurements to queue for processing.
리턴 void

RemoveMeasurements() 공개 메소드

This removes a range of measurements from the internal measurement queue.
This method is typically only used to curtail size of measurement queue if it's getting too large. If more points are requested than there are points available - all points in the queue will be removed.
public RemoveMeasurements ( int total ) : void
total int
리턴 void

Start() 공개 메소드

Starts this OutputAdapterBase and initiates connection cycle to data output stream.
public Start ( ) : void
리턴 void

Stop() 공개 메소드

Stops this OutputAdapterBase and disconnects from data output stream.
public Stop ( ) : void
리턴 void