sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\debug\crashMonitor\src\scmmulticrashinfo.cpp sl@0: // Class to store info about the crash flash to enable multiple crashes sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #include sl@0: sl@0: namespace Debug sl@0: { sl@0: /** sl@0: * constructor sl@0: */ sl@0: SCMMultiCrashInfo::SCMMultiCrashInfo() sl@0: : iFirstBlock(NULL) sl@0: , iCurrentBlock(NULL) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: * destructor sl@0: */ sl@0: SCMMultiCrashInfo::~SCMMultiCrashInfo() sl@0: { sl@0: ClearList(); sl@0: } sl@0: sl@0: /** add a pointer to a block to the list - takes ownership of block sl@0: * @param SCMCrashBlockEntry* aBlockEntry block to add sl@0: */ sl@0: void SCMMultiCrashInfo::AddBlock(SCMCrashBlockEntry* aBlockEntry) sl@0: { sl@0: if(aBlockEntry) sl@0: { sl@0: CLTRACE4("SCMMultiCrashInfo::AddBlock iBlockOffset = [%d] [0x%X] iBlockSize = [%d] [0x%X]" sl@0: , aBlockEntry->iBlockOffset,aBlockEntry->iBlockOffset, aBlockEntry->iBlockSize, aBlockEntry->iBlockSize); sl@0: if(!iFirstBlock) sl@0: { sl@0: // adding to empty list sl@0: iFirstBlock = aBlockEntry; sl@0: iCurrentBlock = iFirstBlock; sl@0: } sl@0: else sl@0: { sl@0: SCMCrashBlockEntry* p = iFirstBlock; sl@0: while(p->iNext) sl@0: { sl@0: p = p->iNext; sl@0: } sl@0: p->iNext = aBlockEntry; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: CLTRACE("SCMMultiCrashInfo::AddBlock Adding a NULL block !"); sl@0: } sl@0: } sl@0: sl@0: sl@0: /** add a pointer to a block to the list - takes ownership of block sl@0: * @return SCMCrashBlockEntry* returns NULL when no more blocks sl@0: * @param none sl@0: */ sl@0: SCMCrashBlockEntry* SCMMultiCrashInfo::GetNextBlock() sl@0: { sl@0: SCMCrashBlockEntry* p = iCurrentBlock; sl@0: if(iCurrentBlock) sl@0: { sl@0: iCurrentBlock = iCurrentBlock->iNext; sl@0: } sl@0: return p; sl@0: } sl@0: sl@0: /** sl@0: * sets current block to first in list sl@0: */ sl@0: void SCMMultiCrashInfo::Reset() sl@0: { sl@0: iCurrentBlock = iFirstBlock; sl@0: } sl@0: sl@0: /** sl@0: * Clears all entries in the list sl@0: */ sl@0: void SCMMultiCrashInfo::ClearList() sl@0: { sl@0: SCMCrashBlockEntry* p = iFirstBlock; sl@0: sl@0: while(p) sl@0: { sl@0: SCMCrashBlockEntry* tmp = p; sl@0: delete tmp; sl@0: p = p->iNext; sl@0: } sl@0: sl@0: iFirstBlock = iCurrentBlock = NULL; sl@0: } sl@0: } sl@0: sl@0: //eof sl@0: