Exemple #1
0
        public CIRegisterVisBitRange(CIContainer aContainer, uint aIndexMin, uint aIndexMax, string aCategory, string aValues)
            : this(aContainer, aIndexMin, aIndexMax, aCategory)
        {
            if (aValues.Length != base.Range.Size)
            {
                throw new ArgumentException("Values are outside of range");
            }
            //
            int index = (int)aIndexMax;

            foreach (char c in aValues)
            {
                TBit value = TBit.EBitClear;
                if (c == VisUtilities.KBitIsSet)
                {
                    value = TBit.EBitSet;
                }
                else if (c == VisUtilities.KBitIsClear)
                {
                }
                else
                {
                    throw new ArgumentException("Invalid bit value");
                }

                base.AddBit(index, value, aCategory);
                --index;
            }
        }
 public CIRegisterVisBit(CIContainer aContainer, int aIndex, TBit aValue, string aCategory, string aInterpretation)
     : base(aContainer)
 {
     Index          = aIndex;
     Value          = aValue;
     Category       = aCategory;
     Interpretation = aInterpretation;
 }
        public void AddBit(int aIndex, TBit aValue, string aCategory, string aInterpretation)
        {
            CIRegisterVisBit bit = new CIRegisterVisBit(Container);

            bit.Index          = aIndex;
            bit.Value          = aValue;
            bit.Category       = aCategory;
            bit.Interpretation = aInterpretation;
            //
            Add(bit);
        }
        public string this[TBit aBit]
        {
            get
            {
                switch (aBit)
                {
                case TBit.EBitSet:
                    return(iValueCharacters[0]);

                default:
                case TBit.EBitClear:
                    return(iValueCharacters[1]);
                }
            }
            set
            {
                string bitVal = value;
                //
                if (bitVal.Length > 1)
                {
                    throw new ArgumentException("Bit value must be a maximum of one character");
                }
                //
                switch (aBit)
                {
                case TBit.EBitSet:
                    iValueCharacters[0] = bitVal;
                    break;

                default:
                case TBit.EBitClear:
                    iValueCharacters[1] = bitVal;
                    break;
                }
            }
        }
 public void AddBit(int aIndex, TBit aValue, string aCategory)
 {
     AddBit(aIndex, aValue, aCategory, string.Empty);
 }