crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianStackLib/Data/Source/Primer/StackEnginePrimer.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.Collections.Generic;
       
    19 using System.Text;
       
    20 using System.Text.RegularExpressions;
       
    21 using System.IO;
       
    22 using SymbianUtils.DataBuffer;
       
    23 using SymbianUtils.DataBuffer.Entry;
       
    24 using SymbianUtils.DataBuffer.Primer;
       
    25 using SymbianStackLib.Engine;
       
    26 using SymbianStackLib.Data.Source;
       
    27 
       
    28 namespace SymbianStackLib.Data.Source.Primer
       
    29 {
       
    30     public sealed class StackEnginePrimer : DataBufferPrimer
       
    31     {
       
    32         #region Constructors
       
    33         internal StackEnginePrimer( StackEngine aEngine )
       
    34             : base( aEngine.DataSource )
       
    35         {
       
    36             iEngine = aEngine;
       
    37             //
       
    38             base.LineNotHandled += new DataBufferPrimerUnhandledLine( StackEnginePrimer_LineNotHandled );
       
    39             base.PrimerComplete += new DataBufferPrimerCompleteHandler( StackEnginePrimer_PrimerComplete );
       
    40         }
       
    41         #endregion
       
    42 
       
    43         #region Event handlers
       
    44         void StackEnginePrimer_PrimerComplete( DataBufferPrimer aPrimer, DataBuffer aBuffer, uint aFirstByteAddress, uint aLastByteAddress )
       
    45         {
       
    46             SeedAddressRangeBasedUponData();
       
    47         }
       
    48 
       
    49         void StackEnginePrimer_LineNotHandled( DataBufferPrimer aPrimer, DataBuffer aBuffer, string aLine )
       
    50         {
       
    51             iEngine.Prefixes.TryAgainstPrefixes( aLine );
       
    52         }
       
    53         #endregion
       
    54 
       
    55         #region Properties
       
    56         #endregion
       
    57 
       
    58         #region Internal methods
       
    59         private void SeedAddressRangeBasedUponData()
       
    60         {
       
    61             uint top = iEngine.DataSource.First.Address;
       
    62             if ( top != 0 && iEngine.AddressInfo.Top == 0 )
       
    63             {
       
    64                 iEngine.AddressInfo.Top = top;
       
    65             }
       
    66             //
       
    67             uint baseAddr = iEngine.DataSource.Last.Address;
       
    68             if ( baseAddr != 0 && iEngine.AddressInfo.Base == 0 )
       
    69             {
       
    70                 iEngine.AddressInfo.Base = baseAddr;
       
    71             }
       
    72         }
       
    73         #endregion
       
    74 
       
    75         #region Data members
       
    76         private readonly StackEngine iEngine;
       
    77         #endregion
       
    78     }
       
    79 }