//******************************************************************************************************
// SignalReferenceMeasurement.cs - Gbtc
//
// Copyright © 2012, Grid Protection Alliance. All Rights Reserved.
//
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
// not use this file except in compliance with the License. You may obtain a copy of the License at:
//
// http://www.opensource.org/licenses/MIT
//
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
// License for the specific language governing permissions and limitations.
//
// Code Modification History:
// ----------------------------------------------------------------------------------------------------
// 05/26/2009 - J. Ritchie Carroll
// Generated original version of source code.
// 09/15/2009 - Stephen C. Wills
// Added new header and license agreement.
// 12/17/2012 - Starlynn Danyelle Gilliam
// Modified Header.
//
//******************************************************************************************************
using System;
using GSF;
using GSF.TimeSeries;
using GSF.Units.EE;
namespace PhasorProtocolAdapters
{
///
/// Represents an wrapper that is associated with a .
///
internal sealed class SignalReferenceMeasurement : IMeasurement
{
#region [ Members ]
// Fields
private readonly IMeasurement m_measurement;
#endregion
#region [ Constructors ]
///
/// Constructs a new from the specified parameters.
///
/// Source value.
/// Associated .
public SignalReferenceMeasurement(IMeasurement measurement, SignalReference signalReference)
{
m_measurement = measurement;
SignalReference = signalReference;
}
#endregion
#region [ Properties ]
///
/// Gets the associated with this .
///
public SignalReference SignalReference { get; }
///
/// Gets the primary key (a , of this .
///
public MeasurementKey Key => m_measurement.Key;
///
/// Gets or sets the based signal ID of this , if available.
///
public Guid ID => m_measurement.ID;
///
/// Gets or sets associated with this .
///
public MeasurementStateFlags StateFlags
{
get => m_measurement.StateFlags;
set => m_measurement.StateFlags = value;
}
///
/// Gets the text based tag name of this .
///
public string TagName => m_measurement.TagName;
///
/// Gets or sets the raw measurement value that is not offset by and .
///
/// Raw value of this (i.e., value that is not offset by and ).
public double Value
{
get => m_measurement.Value;
set => m_measurement.Value = value;
}
///
/// Gets the adjusted numeric value of this measurement, taking into account the specified and offsets.
///
///
/// Note that returned value will be offset by and .
///
/// offset by and (i.e., * + ).
public double AdjustedValue => m_measurement.AdjustedValue;
///
/// Gets an offset to add to the measurement value. This defaults to 0.0.
///
public double Adder => m_measurement.Adder;
///
/// Gets a multiplicative offset to apply to the measurement value. This defaults to 1.0.
///
public double Multiplier => m_measurement.Multiplier;
///
/// Gets or sets exact timestamp, in ticks, of the data represented by this .
///
///
/// The value of this property represents the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001.
///
public Ticks Timestamp
{
get => m_measurement.Timestamp;
set => m_measurement.Timestamp = value;
}
///
/// Gets the life-span of this since its creation.
///
public ShortTime Lifespan => m_measurement.Lifespan;
///
/// Gets timestamp, in ticks, of when this was created.
///
public Ticks CreatedTimestamp => m_measurement.CreatedTimestamp;
///
/// Gets function used to apply a down-sampling filter over a sequence of values.
///
public MeasurementValueFilterFunction MeasurementValueFilter => m_measurement.MeasurementValueFilter;
///
/// Gets or sets associated metadata values for the .
///
public MeasurementMetadata Metadata
{
get => m_measurement.Metadata;
set => m_measurement.Metadata = value;
}
BigBinaryValue ITimeSeriesValue.Value
{
get => ((ITimeSeriesValue)m_measurement).Value;
set => ((ITimeSeriesValue)m_measurement).Value = value;
}
#endregion
#region [ Methods ]
///
/// Determines whether the specified is equal to the current .
///
/// The to compare with the current .
///
/// true if the specified is equal to the current ;
/// otherwise, false.
///
public bool Equals(ITimeSeriesValue other) => m_measurement.Equals(other);
///
/// Compares the with the specified .
///
/// The to compare with the current .
/// A 32-bit signed integer that indicates the relative order of the objects being compared.
/// is not an .
/// Measurement implementations should compare by hash code.
public int CompareTo(object obj) => m_measurement.CompareTo(obj);
///
/// Compares the with an .
///
/// The to compare with the current .
/// A 32-bit signed integer that indicates the relative order of the objects being compared.
/// Measurement implementations should compare by hash code.
public int CompareTo(ITimeSeriesValue other) => m_measurement.CompareTo(other);
#endregion
}
}