/// <summary> /// Adds a register value to the collection. /// </summary> /// <param name="item"><see cref="PartialRegisterInfo"/> to be added to the collection.</param> /// <exception cref="ArgumentException"> /// <paramref name="item"/>'s accessilibity is <see cref="Access.None"/>, the collection already contains an item with that /// designator, or the item's register width is not equal to that of this collection. /// </exception> /// <exception cref="ArgumentNullException"><paramref name="item"/> is a null reference.</exception> public void Add(PartialRegisterInfo item) { if (item == null) { throw new ArgumentNullException(nameof(item)); } if (item.FullRegisterWidth != RegisterWidth) { throw new ArgumentException($"The register ({item.Name}) value's width ({item.FullRegisterWidth}) is not equal to the collection's allowed width ({RegisterWidth}).", nameof(item)); } base.Add(item); }
/// <summary> /// Gets a bit error description for the specified register value. /// </summary> /// <param name="item"><see cref="PartialRegisterInfo"/> object to get the description of.</param> /// <returns>Unique description of the <see cref="PartialRegisterInfo"/> for use in error messages.</returns> private string GetBitErrorMessageInfo(PartialRegisterInfo item) { return($"Designator: {item.Designator}, Start bit: {item.StartBit}, End bit: {item.EndBit}"); }