SpectMorph
smleakdebugger.hh
1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
2 
3 #ifndef SPECTMORPH_LEAK_DEBUGGER_HH
4 #define SPECTMORPH_LEAK_DEBUGGER_HH
5 
6 #include <map>
7 
8 #include <QMutex>
9 
10 namespace SpectMorph
11 {
12 
14 {
15  QMutex mutex;
16  std::map<void *, int> ptr_map;
17  std::string type;
18 
19  void ptr_add (void *p);
20  void ptr_del (void *p);
21 
22 public:
23  LeakDebugger (const std::string& name);
24  ~LeakDebugger();
25 
26  template<class T> void add (T *instance) { ptr_add (static_cast<void *> (instance)); }
27  template<class T> void del (T *instance) { ptr_del (static_cast<void *> (instance)); }
28 };
29 
30 }
31 
32 #endif
Definition: smleakdebugger.hh:13
Definition: smalignedarray.cc:7