crashanalysercmd/Libraries/Engine/CrashItemLib/Crash/Registers/Factory/CIRegisterFactory.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.Threads;
       
    24 using CrashItemLib.Crash.Registers;
       
    25 using CrashItemLib.Crash.Registers.Special;
       
    26 using SymbianStructuresLib.Arm.Registers;
       
    27 
       
    28 namespace CrashItemLib.Crash.Registers.Factory
       
    29 {
       
    30     internal static class CIRegisterFactory
       
    31 	{
       
    32         public static CIRegister New( TArmRegisterType aType, uint aValue, CIRegisterList aList )
       
    33         {
       
    34             CIRegister ret = New( aType, aValue, ArmRegister.GetTypeName( aType ), aList );
       
    35             return ret;
       
    36         }
       
    37 
       
    38         public static CIRegister New( TArmRegisterType aType, uint aValue, string aName, CIRegisterList aList )
       
    39         {
       
    40             CIRegister ret = null;
       
    41             //
       
    42             switch ( aType )
       
    43             {
       
    44             case TArmRegisterType.EArmReg_CPSR:
       
    45                 ret = new CIRegisterCPSR( aList, aValue );
       
    46                 break;
       
    47             case TArmRegisterType.EArmReg_FSR:
       
    48                 ret = new CIRegisterFSR( aList, aValue );
       
    49                 break;
       
    50             case TArmRegisterType.EArmReg_EXCCODE:
       
    51                 ret = new CIRegisterExcCode( aList, aValue );
       
    52                 break;
       
    53             default:
       
    54                 ret = new CIRegister( aList, aType, aName, aValue );
       
    55                 break;
       
    56             }
       
    57             //
       
    58             System.Diagnostics.Debug.Assert( ret.Type == aType );
       
    59             System.Diagnostics.Debug.Assert( ret.Value == aValue );
       
    60             System.Diagnostics.Debug.Assert( ret.Name == aName );
       
    61             //
       
    62             return ret;
       
    63         }
       
    64     }
       
    65 }