using System;
// ReSharper disable once CheckNamespace
namespace DTS.DASLib.Service
{
///
///
/// this attribute allows us to associate a max input range in mV for a gain
/// note that this can be computed using the gain itself and the input range
/// but this allows us to more tightly control things (say by using 2450 instead of 2500 for full range or something similar)
/// http://fogbugz/fogbugz/default.asp?10080
///
public class MaxInputRangeAttribute : Attribute
{
///
/// returns the max input range in mV for gain
/// http://fogbugz/fogbugz/default.asp?10080
///
///
///
public static double GetMaxInputRangemV(object o)
{
if (o == null) return 0D;
var mi = o.GetType().GetMember(o.ToString());
if (mi.Length <= 0) return 0D;
return GetCustomAttribute(mi[0], typeof(MaxInputRangeAttribute)) is MaxInputRangeAttribute attr ? attr._maximumInputRangemV : 0D;
}
private readonly double _maximumInputRangemV;
public MaxInputRangeAttribute(double maxInputRangemV)
{
_maximumInputRangemV = maxInputRangemV;
}
}
}