public uint GetBits <T>(int numBits, T attribute) { uint value = GetBits(numBits); Result.AddAttribute(attribute, value); return(value); }
public bool GetBit <T>(T attributeName) { bool value = GetBit(); Result.AddAttribute(attributeName, value); return(value); }
public uint GetExpGolombCoded <T>(T attributeName, IValidityResultFormatter optionResultFormatter) { uint value = GetExpGolombCoded(); // Add and verify the option attribute // FIXME: is the cast to 'int' necessary!? Result.AddAttribute(attributeName, (int)value, optionResultFormatter); return(value); }
public TEnum GetBits <TAttribute, TEnum>(int numBits, TAttribute attribute, EnumResultFormatter <TEnum> enumResultFormatter) { int value = (int)GetBits(numBits); // Add and verify the option attribute Result.AddAttribute(attribute, value, enumResultFormatter); if (!enumResultFormatter.IsValid(value)) { return(default(TEnum)); } return((TEnum)Enum.ToObject(typeof(TEnum), value)); // FIXME: this is possibly too slow!! }
public int GetSignedExpGolombCoded <T>(T attributeName, int minValue, int maxValue) { int value = GetSignedExpGolombCoded(); if ((value < minValue) || (value > maxValue)) { Result.AddInvalidAttribute(attributeName, value); return(maxValue); } Result.AddAttribute(attributeName, value); return(value); }
public uint GetExpGolombCoded <T>(T attributeName, uint maxCodeNum) { uint value = GetExpGolombCoded(); if (value > maxCodeNum) { Result.AddInvalidAttribute(attributeName, value); return(maxCodeNum); } Result.AddAttribute(attributeName, value); return(value); }
public uint GetFixedBits <T>(int numBits, uint bitCode, T attributeName) { uint value = GetBits(numBits); if (value == bitCode) { Result.AddAttribute(attributeName, value); } else { Result.AddInvalidAttribute(attributeName, value); } return(value); }
public byte GetByte <T>(bool align, T attributeName, byte maxValue) { byte value = GetByte(align); if (value > maxValue) { Result.AddInvalidAttribute(attributeName, value); } else { Result.AddAttribute(attributeName, value); } return(Math.Min(value, maxValue)); }