sysperfana/heapanalyser/Libraries/Engine/HeapLib/Reconstructor/RHeap/Extractor/ExtractionState.cs
changeset 8 15296fd0af4a
equal deleted inserted replaced
7:8e12a575a9b5 8:15296fd0af4a
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * Redistribution and use in source and binary forms, with or without
       
     6 * modification, are permitted provided that the following conditions are met:
       
     7 *
       
     8 * - Redistributions of source code must retain the above copyright notice,
       
     9 *   this list of conditions and the following disclaimer.
       
    10 * - Redistributions in binary form must reproduce the above copyright notice,
       
    11 *   this list of conditions and the following disclaimer in the documentation
       
    12 *   and/or other materials provided with the distribution.
       
    13 * - Neither the name of Nokia Corporation nor the names of its contributors
       
    14 *   may be used to endorse or promote products derived from this software
       
    15 *   without specific prior written permission.
       
    16 *
       
    17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
       
    18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       
    20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
       
    21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
       
    22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
       
    23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
       
    24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
       
    25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
       
    26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
       
    27 * POSSIBILITY OF SUCH DAMAGE.
       
    28 * 
       
    29 * Initial Contributors:
       
    30 * Nokia Corporation - initial contribution.
       
    31 *
       
    32 * Contributors:
       
    33 *
       
    34 * Description: 
       
    35 *
       
    36 */
       
    37 
       
    38 using System;
       
    39 using System.Collections.Generic;
       
    40 using System.Text;
       
    41 using HeapLib.Reconstructor.DataSources;
       
    42 
       
    43 namespace HeapLib.Reconstructor.RHeap.Extractor
       
    44 {
       
    45     internal class ExtractionState
       
    46     {
       
    47         #region Constructors & destructor
       
    48         public ExtractionState( DataSource aSource )
       
    49         {
       
    50             iDataSource = aSource;
       
    51         }
       
    52         #endregion
       
    53 
       
    54         #region API
       
    55         public bool IsFreeCellAddress()
       
    56         {
       
    57             bool ret = false;
       
    58             //
       
    59             uint address = iCurrentAddress;
       
    60             if ( address == iNextFreeCellAddress )
       
    61             {
       
    62                 ret = true;
       
    63             }
       
    64             else
       
    65             {
       
    66                 ret = iDataSource.MetaData.Heap.InfoFree.IsFreeCell( address );
       
    67             }
       
    68             //
       
    69             return ret;
       
    70         }
       
    71         #endregion
       
    72 
       
    73         #region Properties
       
    74         public bool DebugEnabled
       
    75         {
       
    76             get { return iDebugEnabled; }
       
    77             set { iDebugEnabled = value; }
       
    78         }
       
    79 
       
    80         public bool EncounteredException
       
    81         {
       
    82             get { return iEncounteredException; }
       
    83             set { iEncounteredException = value; }
       
    84         }
       
    85 
       
    86         public uint NextFreeCellAddress
       
    87         {
       
    88             get { return iNextFreeCellAddress; }
       
    89             set { iNextFreeCellAddress = value; }
       
    90         }
       
    91 
       
    92         public uint NextFreeCellLength
       
    93         {
       
    94             get { return iNextFreeCellLength; }
       
    95             set { iNextFreeCellLength = value; }
       
    96         }
       
    97 
       
    98         public uint NextCellAddress
       
    99         {
       
   100             get { return iStartOfNextCell; }
       
   101             set { iStartOfNextCell = value; }
       
   102         }
       
   103 
       
   104         public uint ExpectedAddress
       
   105         {
       
   106             get { return iNextExpectedAddress; }
       
   107             set { iNextExpectedAddress = value; }
       
   108         }
       
   109 
       
   110         public uint CurrentAddress
       
   111         {
       
   112             get { return iCurrentAddress; }
       
   113             set { iCurrentAddress = value; }
       
   114         }
       
   115         #endregion
       
   116 
       
   117         #region Internal methods
       
   118         #endregion
       
   119 
       
   120         #region Internal constants
       
   121         private const int KBaseHex = 16;
       
   122         #endregion
       
   123 
       
   124         #region Data members
       
   125         private readonly DataSource iDataSource;
       
   126         private bool iDebugEnabled = false;
       
   127         private bool iEncounteredException = false;
       
   128         private uint iNextFreeCellAddress;
       
   129         private uint iNextFreeCellLength;
       
   130         private uint iNextExpectedAddress;
       
   131         private uint iCurrentAddress = 0;
       
   132         private uint iStartOfNextCell;
       
   133         #endregion
       
   134     }
       
   135 }