RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
Debug.h
1/***********************************************************************
2 * The rDock program was developed from 1998 - 2006 by the software team
3 * at RiboTargets (subsequently Vernalis (R&D) Ltd).
4 * In 2006, the software was licensed to the University of York for
5 * maintenance and distribution.
6 * In 2012, Vernalis and the University of York agreed to release the
7 * program as Open Source software.
8 * This version is licensed under GNU-LGPL version 3.0 with support from
9 * the University of Barcelona.
10 * http://rdock.sourceforge.net/
11 ***********************************************************************/
12
13// Tools for tracking of object construction and destruction for
14// debugging purposes
15
16#ifndef _RBTDEBUG_H_
17#define _RBTDEBUG_H_
18
19#ifdef _RBTOBJECTCOUNTER
20
21#include <map>
22
23namespace rxdock {
24
25// Object counter class for debugging no. of object constructions and
26// destructions
27class ObjectCounter {
28public:
29 ObjectCounter();
30 ~ObjectCounter();
31 friend std::ostream &operator<<(std::ostream &s,
32 const ObjectCounter &counter);
33 Int nConstr;
34 Int nCopyConstr;
35 Int nDestr;
36};
37
38// Useful typedefs
39typedef std::map<String, ObjectCounter> ObjectCounterMap;
40typedef ObjectCounterMap::iterator ObjectCounterMapIter;
41
42// External declaration of the one and only object counter map
43extern ObjectCounterMap theObjectCounterMap;
44
45} // namespace rxdock
46
47#define _RBTOBJECTCOUNTER_CONSTR_(class) theObjectCounterMap[(class)].nConstr++
48#define _RBTOBJECTCOUNTER_COPYCONSTR_(class) \
49 theObjectCounterMap[(class)].nCopyConstr++
50#define _RBTOBJECTCOUNTER_DESTR_(class) theObjectCounterMap[(class)].nDestr++
51
52#define _RBTOBJECTCOUNTER_DUMP_(stream) \
53 (stream) << std::endl << "RBT OBJECT COUNTERS:" << std::endl << std::endl; \
54 for (ObjectCounterMapIter dumpIter = theObjectCounterMap.begin(); \
55 dumpIter != theObjectCounterMap.end(); dumpIter++) { \
56 (stream) << (*dumpIter).first << ": " << (*dumpIter).second << std::endl; \
57 }
58
59#else //_RBTOBJECTCOUNTER
60
61#define _RBTOBJECTCOUNTER_CONSTR_(class)
62#define _RBTOBJECTCOUNTER_COPYCONSTR_(class)
63#define _RBTOBJECTCOUNTER_DESTR_(class)
64#define _RBTOBJECTCOUNTER_DUMP_(stream)
65
66#endif //_RBTOBJECTCOUNTER
67
68#endif //_RBTDEBUG_H_