crashanalysercmd/Libraries/Engine/CrashItemLib/Crash/Registers/Visualization/Bits/CIRegisterVisBitRange.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 using System;
       
    18 using System.Text;
       
    19 using System.Collections.Generic;
       
    20 using CrashItemLib.Crash;
       
    21 using CrashItemLib.Crash.Base;
       
    22 using CrashItemLib.Crash.Container;
       
    23 using CrashItemLib.Crash.Registers;
       
    24 using SymbianUtils.Range;
       
    25 using CrashItemLib.Crash.Registers.Visualization.Utilities;
       
    26 
       
    27 namespace CrashItemLib.Crash.Registers.Visualization.Bits
       
    28 {
       
    29     public class CIRegisterVisBitRange : CIRegisterVisBitList
       
    30     {
       
    31         #region Constructors
       
    32         public CIRegisterVisBitRange( CIContainer aContainer, uint aIndexMin, uint aIndexMax )
       
    33             : base( aContainer )
       
    34         {
       
    35             base.Range.Set( aIndexMin, aIndexMax );
       
    36         }
       
    37 
       
    38         public CIRegisterVisBitRange( CIContainer aContainer, uint aIndexMin, uint aIndexMax, string aCategory )
       
    39             : this( aContainer, aIndexMin, aIndexMax )
       
    40         {
       
    41             this.Category = aCategory;
       
    42         }
       
    43 
       
    44         public CIRegisterVisBitRange( CIContainer aContainer, uint aIndexMin, uint aIndexMax, string aCategory, string aValues )
       
    45             : this( aContainer, aIndexMin, aIndexMax, aCategory )
       
    46         {
       
    47             if ( aValues.Length != base.Range.Size )
       
    48             {
       
    49                 throw new ArgumentException( "Values are outside of range" );
       
    50             }
       
    51             //
       
    52             int index = (int) aIndexMax;
       
    53             foreach ( char c in aValues )
       
    54             {
       
    55                 TBit value = TBit.EBitClear;
       
    56                 if ( c == VisUtilities.KBitIsSet )
       
    57                 {
       
    58                     value = TBit.EBitSet;
       
    59                 }
       
    60                 else if ( c == VisUtilities.KBitIsClear )
       
    61                 {
       
    62                 }
       
    63                 else
       
    64                 {
       
    65                     throw new ArgumentException( "Invalid bit value" );
       
    66                 }
       
    67 
       
    68                 base.AddBit( index, value, aCategory );
       
    69                 --index;
       
    70             }
       
    71         }
       
    72          #endregion
       
    73 
       
    74         #region API
       
    75         public void ExtractBits( uint aExtractFrom, string aMask )
       
    76         {
       
    77             foreach ( CIRegisterVisBit bit in VisUtilities.ExtractBits( Container, aExtractFrom, aMask ) )
       
    78             {
       
    79                 this.Add( bit );
       
    80             }
       
    81         }
       
    82 
       
    83         public void ExtractBits( uint aExtractFrom, string aByte3Mask, string aByte2Mask, string aByte1Mask, string aByte0Mask )
       
    84         {
       
    85             foreach ( CIRegisterVisBit bit in VisUtilities.ExtractBits( Container, aExtractFrom, aByte3Mask, aByte2Mask, aByte1Mask, aByte0Mask ) )
       
    86             {
       
    87                 this.Add( bit );
       
    88             }
       
    89         }
       
    90         #endregion
       
    91 
       
    92         #region Properties
       
    93         #endregion
       
    94 
       
    95         #region Internal methods
       
    96         #endregion
       
    97 
       
    98         #region Internal constants
       
    99         #endregion
       
   100 
       
   101         #region Data members
       
   102         #endregion
       
   103     }
       
   104 }