using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DTS.Common.Utilities;
namespace DTS.Common.Enums
{
public class ExcitationVoltageOptions
{
///
/// All available excitation voltages.
///
public enum ExcitationVoltageOption
{
///
/// undefined excitation voltage
///
[VoltageMagnitude(0.0)]
[Description("Undefined")]
Undefined = 1,
///
/// 2V
///
[VoltageMagnitude(2.0)]
[Description("2.0")]
Volt2 = 2,
///
/// 2.5V
///
[VoltageMagnitude(2.5)]
[Description("2.5")]
Volt2_5 = 4,
///
/// 3.0V
///
[VoltageMagnitude(3.0)]
[Description("3.0")]
Volt3 = 8,
///
/// 5V
///
[VoltageMagnitude(5.0)]
[Description("5.0")]
Volt5 = 16,
///
/// 10V
///
[VoltageMagnitude(10.0)]
[Description("10.0")]
Volt10 = 32,
///
/// 1V
///
[VoltageMagnitude(1.0)]
[Description("1.0")]
Volt1 = 64
}
///
/// Attribute for specifying the numerical magnitude of the attached field's
/// "representation". Intended to be used with enumerations whose members represent
/// voltage magnitude options so that the enum item can have a corresponding numerical
/// value that can be extracted and used in calculations.
///
[AttributeUsage(AttributeTargets.Field)]
public class VoltageMagnitudeAttribute : Attribute
{
///
/// returns voltage magnitude
///
public double Value { get; }
///
/// constructs a
/// with a given value
///
///
public VoltageMagnitudeAttribute(double value) { Value = value; }
}
///
/// Object for manipulating voltage option enumeration-attached
/// magnitude values.
///
public class VoltageMagnitudeAttributeCoder
: AttributeCoder
{
///
/// Initializes a object.
///
public VoltageMagnitudeAttributeCoder()
: base(attribute => attribute.Value, null)
{
}
}
}
}