KaliVeda
Toolkit for HIC analysis
KVClassMonitor.h
1 
4 #ifndef __KVCLASSMONITOR_H
5 #define __KVCLASSMONITOR_H
6 
7 #include "KVBase.h"
8 #include <map>
9 #include <string>
10 #include "TEnv.h"
11 
56 class KVClassMonitor : public KVBase {
57 
62  mutable std::map<std::string, int> fChanges;
63 
65 public:
66  virtual ~KVClassMonitor();
67 
68  void Check();
69  void CompareToInit();
70  void SetInitStatistics();
71  std::map<std::string, int>& GetListOfChanges() const;
72 
73  static KVClassMonitor* GetInstance();
74 
76  static void DoCheck(const TString& method, const TString& message)
77  {
78  if (!fDisableCheck && fgClassMonitor) {
79  printf("<%s> : %s\n", method.Data(), message.Data());
81  }
82  }
83 
85  static void DisableChecking()
86  {
88  }
90  static void EnableChecking()
91  {
93  }
94 
95  ClassDef(KVClassMonitor, 0) //Track potential memory leaks
96 };
97 
98 #endif
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:142
Simple tool to track which classes instance count increases over time.
static KVClassMonitor * GetInstance()
Return pointer to unique instance of class monitor class.
std::map< std::string, int > fChanges
list of classes whose number changed in last Check()
std::map< std::string, int > & GetListOfChanges() const
TEnv fClassStats
store class instance statistics
TEnv fClassStatsInit
intitial class instance statistics
static Bool_t fDisableCheck
disable static DoCheck() method
static void DisableChecking()
Disable static DoCheck method.
static void EnableChecking()
Re-enable static DoCheck method.
virtual ~KVClassMonitor()
Destructor.
static void DoCheck(const TString &method, const TString &message)
Print statistics of global singleton if it exists.
void SetInitStatistics()
static KVClassMonitor * fgClassMonitor
singleton
const char * Data() const