/// <summary> /// Initializes a new instance of the <see cref="BaseTypeValue"/> class with /// values extracted from the byte store /// </summary> /// <param name="baseTypeDefinition">The base type definition.</param> /// <param name="theBytes">The bytes.</param> /// <param name="parent">The parent.</param> public BaseTypeValue(BaseTypeDefinition baseTypeDefinition, ByteStore theBytes, Value parent) : this(baseTypeDefinition, parent) { ulong tempValue = 0; switch (m_BaseTypeDefinition.FixedSizeBytes.Value) { case 0: // Special case for end-markers for lists of elements break; case 1: tempValue = theBytes.GetByte(); break; case 2: tempValue = theBytes.GetUint16(); break; case 4: tempValue = theBytes.GetUint32(); break; case 8: tempValue = theBytes.GetUint64(); break; default: throw new DataDictionaryException(String.Format("{0} Illegal ByteSize {1}", m_BaseTypeDefinition.Name, m_BaseTypeDefinition.FixedSizeBytes.Value)); } if (m_BaseTypeDefinition.IsSigned) { SignedValue = (long)tempValue; } else { UnsignedValue = tempValue; } }
/// <summary> /// Initializes a new instance of the <see cref="BaseTypeValue"/> class. /// </summary> /// <param name="theValue">The value.</param> /// <param name="theBaseTypeDefinition">The base type definition.</param> /// <param name="parent">The parent.</param> public BaseTypeValue(long theValue, BaseTypeDefinition theBaseTypeDefinition, Value parent) : base(theBaseTypeDefinition, parent) { SignedValue = theValue; m_BaseTypeDefinition = theBaseTypeDefinition; }
/// <summary> /// Initializes a new instance of the <see cref="BaseTypeValue"/> class /// with default values /// </summary> /// <param name="theBaseTypeDefinition">The base type definition.</param> /// <param name="parent">The parent.</param> public BaseTypeValue(BaseTypeDefinition theBaseTypeDefinition, Value parent) : base(theBaseTypeDefinition, parent) { m_BaseTypeDefinition = theBaseTypeDefinition; }