crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianETMLib/Common/State/Implementations/ETMDecodeStateSynchronized.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 
       
    18 using System;
       
    19 using System.Collections.Generic;
       
    20 using System.Text;
       
    21 using SymbianUtils.BasicTypes;
       
    22 using SymbianETMLib.Common.Types;
       
    23 using SymbianETMLib.Common.Packets;
       
    24 
       
    25 namespace SymbianETMLib.Common.State
       
    26 {
       
    27     public class ETMDecodeStateSynchronized : ETMDecodeState
       
    28     {
       
    29         #region Constructors
       
    30         public ETMDecodeStateSynchronized( ETMStateData aManager )
       
    31             : base( aManager )
       
    32         {
       
    33         }
       
    34         #endregion
       
    35 
       
    36         #region API
       
    37         public override ETMDecodeState HandleByte( SymByte aByte )
       
    38         {
       
    39             ETMDecodeState nextState = this;
       
    40             //
       
    41             ETMPcktBase packet = Packets.Factory.ETMPacketFactory.Create( aByte );
       
    42             if ( packet != null )
       
    43             {
       
    44                 if ( packet is ETMPcktBranch )
       
    45                 {
       
    46                     nextState = new ETMDecodeStateBranch( base.StateData );
       
    47                     base.StateData.PushBack( aByte );
       
    48                 }
       
    49                 else if ( packet is ETMPcktIgnore )
       
    50                 {
       
    51                     nextState = new ETMDecodeStateIgnore( base.StateData );
       
    52                     base.StateData.PushBack( aByte );
       
    53                 }
       
    54                 else if ( packet is ETMPcktISync )
       
    55                 {
       
    56                     nextState = new ETMDecodeStateISync( base.StateData );
       
    57                     base.StateData.PushBack( aByte );
       
    58                 }
       
    59                 else if ( packet is ETMPcktPHeaderFormat1 || packet is ETMPcktPHeaderFormat2 )
       
    60                 {
       
    61                     nextState = new ETMDecodeStatePHeader( base.StateData );
       
    62                     base.StateData.PushBack( aByte );
       
    63                 }
       
    64                 else if ( packet is ETMPcktASync )
       
    65                 {
       
    66                     nextState = new ETMDecodeStateASync( base.StateData );
       
    67                     base.StateData.PushBack( aByte );
       
    68                 }
       
    69                 else if ( packet is ETMPcktOutOfOrderData )
       
    70                 {
       
    71                     nextState = new ETMDecodeStateOutOfOrderData( base.StateData );
       
    72                     base.StateData.PushBack( aByte );
       
    73                 }
       
    74                 else if ( packet is ETMPcktCycleCount )
       
    75                 {
       
    76                     nextState = new ETMDecodeStateCycleCount( base.StateData );
       
    77                 }
       
    78                 else if ( packet is ETMPcktContextID )
       
    79                 {
       
    80                     nextState = new ETMDecodeStateContextID( base.StateData );
       
    81                 }
       
    82                 else
       
    83                 {
       
    84                     base.Trace( string.Format( "OP NOT HANDLED: {0:x2}", aByte ) );
       
    85                     System.Diagnostics.Debug.Assert( false );
       
    86                 }
       
    87             }
       
    88             else
       
    89             {
       
    90                 base.Trace( string.Format( "WARNING: OP NOT RECOGNISED: {0:x2}", aByte ) );
       
    91                 System.Diagnostics.Debug.Assert( false );
       
    92             }
       
    93             //
       
    94             return nextState;
       
    95         }
       
    96         #endregion
       
    97 
       
    98         #region Properties
       
    99         #endregion
       
   100 
       
   101         #region Internal constants
       
   102         #endregion
       
   103 
       
   104         #region From System.Object
       
   105         #endregion
       
   106 
       
   107         #region Data members
       
   108         #endregion
       
   109     }
       
   110 }