diff -r 000000000000 -r 818e61de6cd1 crashanalysercmd/Libraries/Engine/CrashDebuggerLib/Structures/Process/ProcessChunk.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/crashanalysercmd/Libraries/Engine/CrashDebuggerLib/Structures/Process/ProcessChunk.cs Thu Feb 11 15:50:58 2010 +0200 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +using System; +using System.Collections.Generic; +using System.Text; +using CrashDebuggerLib.Structures.KernelObjects; +using CrashDebuggerLib.Structures.Chunk; +using CrashDebuggerLib.Structures.Common; + +namespace CrashDebuggerLib.Structures.Process +{ + public class ProcessChunk : CrashDebuggerAware + { + #region Constructors + public ProcessChunk( CrashDebuggerInfo aCrashDebugger, uint aChunkAddress, int aAccessCount ) + : base( aCrashDebugger ) + { + iChunkAddress = aChunkAddress; + iAccessCount = aAccessCount; + } + #endregion + + #region API + #endregion + + #region Properties + public uint ChunkAddress + { + get { return iChunkAddress; } + set { iChunkAddress = value; } + } + + public Chunk.DChunk Chunk + { + get { return CrashDebugger.ChunkByAddress( ChunkAddress ); } + } + + public int AccessCount + { + get { return iAccessCount; } + set { iAccessCount = value; } + } + #endregion + + #region Internal methods + #endregion + + #region Internal constants + #endregion + + #region From System.Object + public override string ToString() + { + return base.ToString(); + } + #endregion + + #region Data members + private uint iChunkAddress = 0; + private int iAccessCount = 0; + #endregion + } + + public class ProcessChunkCollection : IEnumerable + { + #region Constructors + public ProcessChunkCollection() + { + } + #endregion + + #region API + public void Add( ProcessChunk aChunk ) + { + iEntries.Add( aChunk ); + } + #endregion + + #region Properties + public ProcessChunk this[ int aIndex ] + { + get { return iEntries[ aIndex ]; } + } + + public int Count + { + get { return iEntries.Count; } + } + #endregion + + #region Internal methods + #endregion + + #region Internal constants + #endregion + + #region From System.Object + public override string ToString() + { + return base.ToString(); + } + #endregion + + #region From IEnumerable + public IEnumerator GetEnumerator() + { + return new ProcessChunkEnumerator( this ); + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return new ProcessChunkEnumerator( this ); + } + #endregion + + #region Data members + private List iEntries = new List(); + #endregion + } + + #region Internal enumerator + internal class ProcessChunkEnumerator : IEnumerator + { + #region Constructors + public ProcessChunkEnumerator( ProcessChunkCollection aList ) + { + iList = aList; + } + #endregion + + #region IEnumerator Members + public void Reset() + { + iCurrentIndex = -1; + } + + public object Current + { + get + { + return iList[ iCurrentIndex ]; + } + } + + public bool MoveNext() + { + return ( ++iCurrentIndex < iList.Count ); + } + #endregion + + #region From IEnumerator + ProcessChunk IEnumerator.Current + { + get { return iList[ iCurrentIndex ]; } + } + #endregion + + #region From IDisposable + public void Dispose() + { + } + #endregion + + #region Data members + private readonly ProcessChunkCollection iList; + private int iCurrentIndex = -1; + #endregion + } + #endregion +}