• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kcachegrind

  • sources
  • kde-4.12
  • kdesdk
  • kcachegrind
  • libcore
stackbrowser.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2003 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
3 
4  KCachegrind is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef STACKBROWSER_H
20 #define STACKBROWSER_H
21 
22 #include "tracedata.h"
23 
24 // A history of selected functions within stacks
25 
26 class Stack
27 {
28 public:
29  Stack(TraceFunction*);
30 
31  // extend the stack at top/bottom if possible
32  bool contains(TraceFunction*);
33 
34  void extendBottom();
35  void extendTop();
36 
37  // search for a function on stack calling specified function.
38  // if found, return upper part with new function call
39  Stack* split(TraceFunction*);
40 
41  // increment reference count
42  void ref() { _refCount++; }
43  // decrement reference count
44  bool deref() { return --_refCount; }
45  int refCount() const { return _refCount; }
46 
47  TraceFunction* top() { return _top; }
48  TraceCallList calls() { return _calls; }
49  TraceFunction* caller(TraceFunction*, bool extend);
50  TraceFunction* called(TraceFunction*, bool extend);
51 
52  QString toString();
53 
54 private:
55  Stack(TraceFunction* top, TraceCallList list);
56 
57  // at the top of the stack we have a function...
58  TraceFunction* _top;
59  // list ordered from top to bottom
60  TraceCallList _calls;
61  int _refCount;
62 };
63 
64 class HistoryItem
65 {
66 public:
67  HistoryItem(Stack*, TraceFunction*);
68  ~HistoryItem();
69 
70  Stack* stack() { return _stack; }
71  TraceFunction* function() { return _function; }
72  HistoryItem* last() { return _last; }
73  HistoryItem* next() { return _next; }
74  void setLast(HistoryItem* h) { _last = h; }
75  void setNext(HistoryItem* h) { _next = h; }
76 
77 private:
78 
79  HistoryItem *_last, *_next;
80  Stack* _stack;
81  TraceFunction* _function;
82 };
83 
84 
85 class StackBrowser
86 {
87 public:
88  StackBrowser();
89  ~StackBrowser();
90 
91  // A function was selected. This creates a new history entry
92  HistoryItem* select(TraceFunction*);
93 
94  HistoryItem* current() { return _current; }
95  bool canGoBack();
96  bool canGoForward();
97  bool canGoUp();
98  bool canGoDown();
99  HistoryItem* goBack();
100  HistoryItem* goForward();
101  HistoryItem* goUp();
102  HistoryItem* goDown();
103 
104 private:
105  HistoryItem* _current;
106 };
107 
108 
109 #endif
StackBrowser::goUp
HistoryItem * goUp()
Definition: stackbrowser.cpp:355
Stack::ref
void ref()
Definition: stackbrowser.h:42
HistoryItem::~HistoryItem
~HistoryItem()
Definition: stackbrowser.cpp:274
StackBrowser::canGoDown
bool canGoDown()
Definition: stackbrowser.cpp:394
Stack::called
TraceFunction * called(TraceFunction *, bool extend)
Definition: stackbrowser.cpp:152
StackBrowser::goBack
HistoryItem * goBack()
Definition: stackbrowser.cpp:339
HistoryItem::HistoryItem
HistoryItem(Stack *, TraceFunction *)
Definition: stackbrowser.cpp:257
StackBrowser
Definition: stackbrowser.h:85
TraceFunction
A traced function.
Definition: tracedata.h:1122
StackBrowser::~StackBrowser
~StackBrowser()
Definition: stackbrowser.cpp:296
StackBrowser::StackBrowser
StackBrowser()
Definition: stackbrowser.cpp:291
StackBrowser::canGoUp
bool canGoUp()
Definition: stackbrowser.cpp:387
Stack::caller
TraceFunction * caller(TraceFunction *, bool extend)
Definition: stackbrowser.cpp:134
StackBrowser::goForward
HistoryItem * goForward()
Definition: stackbrowser.cpp:347
Stack::Stack
Stack(TraceFunction *)
Definition: stackbrowser.cpp:33
Stack::toString
QString toString()
Definition: stackbrowser.cpp:245
Stack
Definition: stackbrowser.h:26
tracedata.h
StackBrowser::canGoBack
bool canGoBack()
Definition: stackbrowser.cpp:377
Stack::deref
bool deref()
Definition: stackbrowser.h:44
HistoryItem::stack
Stack * stack()
Definition: stackbrowser.h:70
Stack::split
Stack * split(TraceFunction *)
Definition: stackbrowser.cpp:221
StackBrowser::select
HistoryItem * select(TraceFunction *)
Definition: stackbrowser.cpp:301
HistoryItem::next
HistoryItem * next()
Definition: stackbrowser.h:73
Stack::extendBottom
void extendBottom()
Definition: stackbrowser.cpp:42
HistoryItem::last
HistoryItem * last()
Definition: stackbrowser.h:72
Stack::calls
TraceCallList calls()
Definition: stackbrowser.h:48
Stack::contains
bool contains(TraceFunction *)
Definition: stackbrowser.cpp:177
Stack::extendTop
void extendTop()
Definition: stackbrowser.cpp:92
HistoryItem::setLast
void setLast(HistoryItem *h)
Definition: stackbrowser.h:74
Stack::refCount
int refCount() const
Definition: stackbrowser.h:45
Stack::top
TraceFunction * top()
Definition: stackbrowser.h:47
TraceCallList
QList< TraceCall * > TraceCallList
Definition: tracedata.h:184
HistoryItem
Definition: stackbrowser.h:64
StackBrowser::current
HistoryItem * current()
Definition: stackbrowser.h:94
StackBrowser::goDown
HistoryItem * goDown()
Definition: stackbrowser.cpp:366
StackBrowser::canGoForward
bool canGoForward()
Definition: stackbrowser.cpp:382
HistoryItem::setNext
void setNext(HistoryItem *h)
Definition: stackbrowser.h:75
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kcachegrind

Skip menu "kcachegrind"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal