示例#1
0
 // Static Constructor
 static MeasurementKey()
 {
     // Order of operations is critical here since MeasurementKey and MeasurementMetadata have a circular reference
     Undefined = CreateUndefinedMeasurementKey();
     MeasurementMetadata.CreateUndefinedMeasurementMetadata();
     Undefined.m_metadata = MeasurementMetadata.Undefined;
 }
示例#2
0
 private MeasurementKey(Guid signalID, ulong id, string source)
 {
     m_signalID  = signalID;
     m_id        = id;
     m_source    = source;
     m_hashCode  = base.GetHashCode();
     m_runtimeID = Interlocked.Increment(ref s_nextRuntimeID) - 1; // Returns the incremented value. Hints the -1
     m_metadata  = new MeasurementMetadata(this, null, 0, 1);
 }
示例#3
0
        /// <summary>
        /// Updates the values of the <see cref="Metadata"/>.
        /// </summary>
        /// <param name="tagName">Gets or sets the text based tag name.</param>
        /// <param name="adder">Defines an offset to add to the <see cref="IMeasurement"/> value.</param>
        /// <param name="multiplier">Defines a multiplicative offset to apply to the <see cref="IMeasurement"/> value.</param>

        public void SetMeasurementMetadata(string tagName, double adder, double multiplier)
        {
            if (this == Undefined)
            {
                throw new NotSupportedException("Cannot set data source information for an undefined measurement.");
            }

            if (m_metadata.TagName != tagName || m_metadata.Adder != adder || m_metadata.Multiplier != multiplier)
            {
                m_metadata = new MeasurementMetadata(this, tagName, adder, multiplier);
            }
        }
 /// <summary>
 /// Constructs a new <see cref="Measurement"/> using default settings.
 /// </summary>
 public Measurement()
 {
     m_metadata = MeasurementMetadata.Undefined;
     m_lifespan = ShortTime.Now;
 }
示例#5
0
        // Static Methods

        // Create measurement metadata for undefined
        internal static void CreateUndefinedMeasurementMetadata()
        {
            s_undefined = s_undefined ?? new MeasurementMetadata(MeasurementKey.Undefined, null, 0, 1);
        }