1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include "StackTrace.h" 7 8 9 StackTrace::StackTrace() 10 { 11 } 12 13 14 StackTrace::~StackTrace() 15 { 16 for (int32 i = 0; StackFrame* frame = FrameAt(i); i++) 17 frame->ReleaseReference(); 18 } 19 20 21 bool 22 StackTrace::AddFrame(StackFrame* frame) 23 { 24 if (fStackFrames.AddItem(frame)) 25 return true; 26 27 frame->ReleaseReference(); 28 return false; 29 } 30 31 32 int32 33 StackTrace::CountFrames() const 34 { 35 return fStackFrames.CountItems(); 36 } 37 38 39 StackFrame* 40 StackTrace::FrameAt(int32 index) const 41 { 42 return fStackFrames.ItemAt(index); 43 } 44