CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkBackTrace.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  Library: CTK
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 =============================================================================*/
21 
22 #ifndef __ctkBackTrace_h
23 #define __ctkBackTrace_h
24 
25 // CTK includes
26 #include <ctkCoreExport.h>
27 
28 // Qt includes
29 #include <QScopedPointer>
30 #include <QString>
31 
32 
33 struct ctkBackTracePrivate;
34 
35 //---------------------------------------------------------------------------
43 class CTK_CORE_EXPORT ctkBackTrace
44 {
45 public:
46 
47  static size_t const DefaultStackSize;
48 
49  ctkBackTrace(const ctkBackTrace& other);
50 
55  ctkBackTrace(size_t framesNumber = DefaultStackSize);
56 
57  virtual ~ctkBackTrace() throw();
58 
63  size_t stackSize() const;
64 
71  void* returnAddress(unsigned frameNumber) const;
72 
79  QString stackFrame(unsigned frameNumber) const;
80 
89  QList<QString> stackTrace() const;
90 
91 private:
92 
93  QScopedPointer<ctkBackTracePrivate> d;
94 };
95 
96 #ifdef Q_CC_MSVC
97 namespace ctk {
98 CTK_CORE_EXPORT bool DebugSymInitialize();
99 }
100 #endif
101 
102 #endif // __ctkBackTrace_h
Obtains a back trace from the current execution context.
Definition: ctkBackTrace.h:44
static size_t const DefaultStackSize
Definition: ctkBackTrace.h:47
ctkBackTrace(size_t framesNumber=DefaultStackSize)
Create a back trace.
ctkBackTrace(const ctkBackTrace &other)
virtual ~ctkBackTrace()