/// <summary>
 /// Initializes a new instance of the <see cref="EnumValue"/> class.
 /// </summary>
 /// <param name="theEnumDefinition">The enum definition.</param>
 /// <param name="parent">The parent.</param>
 public EnumValue(EnumDefinition theEnumDefinition, Value parent)
     : base(theEnumDefinition, parent)
 {
     m_EnumDefinition = theEnumDefinition;
     IntegerValue = m_EnumDefinition.Literals[0].Value;
     StringValue = m_EnumDefinition.Literals[0].Name;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="EnumValue"/> class by extracting the
        /// encoded value from the byte store
        /// </summary>
        /// <param name="theEnumDefinition">The enum definition.</param>
        /// <param name="theBytes">The bytes.</param>
        /// <param name="parent">The parent.</param>
        public EnumValue(EnumDefinition theEnumDefinition, ByteStore theBytes, Value parent)
            : this(theEnumDefinition, parent)
        {
            switch (theEnumDefinition.FixedSizeBytes)
            {
                case 1:
                    IntegerValue = (int)theBytes.GetByte();
                    break;
                case 2:
                    IntegerValue = (int)theBytes.GetUint16();
                    break;
                case 4:
                    IntegerValue = (int)theBytes.GetUint32();
                    break;
                default:
                    throw new DataDictionaryException(string.Format("Illegal byte size {0} for enum {1}", theEnumDefinition.FixedSizeBytes, m_EnumDefinition.Name));
            }

            StringValue = m_EnumDefinition.IntegerValueToString(IntegerValue);
        }