Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
berryDebugUtil.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef BERRYDEBUGUTIL_H_
15 #define BERRYDEBUGUTIL_H_
16 
17 #include <QHash>
18 #include <QSet>
19 #include <QList>
20 
22 
23 class QDir;
24 
25 namespace berry {
26 
27 class Object;
28 class DebugBreakpointManager;
29 struct IDebugObjectListener;
30 template <class T> class SmartPointer;
31 
33 {
34 
35 public:
36 
37  static DebugBreakpointManager* GetBreakpointManager();
38 
39  static void TraceObject(const Object*);
40  static void TraceObject(unsigned int traceId);
41  static void TraceClass(const QString& className);
42 
43  static void StopTracing(unsigned int traceId);
44  static void StopTracing(const Object* obj);
45  static void StopTracing(const QString& className);
46 
47  static bool IsTraced(const Object* object);
48  static bool IsTraced(unsigned int traceId);
49  static bool IsTraced(const QString& className);
50 
51  static QSet<unsigned int> GetTracedObjects();
52 
53  static const Object* GetObject(unsigned int traceId);
54 
55  static QList<unsigned int> GetSmartPointerIDs(const Object* objectPointer, const QList<unsigned int>& excludeList = QList<unsigned int>());
56  static QList<const Object*> GetRegisteredObjects();
57 
58  static void PrintSmartPointerIDs(const Object* objectPointer, const QList<unsigned int>& excludeList = QList<unsigned int>());
59 
60  static void ResetObjectSummary();
61  static bool PrintObjectSummary(bool details = false);
62  static bool PrintObjectSummary(const QString& className, bool details = false);
63 
64  static void AddObjectListener(IDebugObjectListener* listener);
65  static void RemoveObjectListener(IDebugObjectListener* listener);
66 
67  static void SaveState(const QDir& path);
68  static void RestoreState(const QDir& path);
69 
70  // ******* for internal use only *************
71  static unsigned int& GetSmartPointerCounter();
72  static void RegisterSmartPointer(unsigned int smartPointerId, const Object* objectPointer, bool recordStack = false);
73  static void UnregisterSmartPointer(unsigned int smartPointerId, const Object* objectPointer);
74  static void RegisterObject(const Object* objectPointer);
75  static void UnregisterObject(const Object* objectPointer);
76  // *******************************************
77 
78 private:
79 
80  static const QString DEBUG_UTIL_XML;
81 
82  static const QString DEBUGUTIL_TAG;
83  static const QString TRACEOBJECT_TAG;
84  static const QString TRACECLASS_TAG;
85 
86  static const QString ID_ATTR;
87  static const QString NAME_ATTR;
88 
89  static bool GetPersistencePath(QDir& path);
90 
91  static QHash<quint32, QList<unsigned int> > m_TraceIdToSmartPointerMap;
92  typedef QHash<quint32, const Object* > TraceIdToObjectType;
93  static TraceIdToObjectType m_TraceIdToObjectMap;
94  static QSet<unsigned int> m_TracedObjects;
95  static QSet<QString> m_TracedClasses;
96 };
97 
98 }
99 
100 
101 #endif /* BERRYDEBUGUTIL_H_ */
org_blueberry_core_runtime_Export.h
berry::DebugUtil
Definition: berryDebugUtil.h:32
berry::Object
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:72
berry::IDebugObjectListener
Definition: berryIDebugObjectListener.h:26
org_blueberry_core_runtime_EXPORT
#define org_blueberry_core_runtime_EXPORT
Definition: org_blueberry_core_runtime_Export.h:26
berry::DebugBreakpointManager
Definition: berryDebugBreakpointManager.h:26
berry
Definition: QmitkPropertyItemModel.h:24