DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
dd4hep::InstanceCount Struct Reference

Helper to support object counting when debugging memory leaks. More...

#include <InstanceCount.h>

Classes

class  Counter
 Internal class to could object constructions and destructions. More...
 

Public Types

enum  { NONE = 1 << 0, STRING = 1 << 1, TYPEINFO = 1 << 2, ALL = STRING | TYPEINFO }
 Enumeration to steer the output. More...
 
typedef long long int counter_t
 

Public Member Functions

 InstanceCount ()
 Standard Constructor - No need to call explicitly. More...
 
virtual ~InstanceCount ()
 Standard Destructor - No need to call explicitly. More...
 

Static Public Member Functions

static CountergetCounter (const std::type_info &typ)
 Access counter object for local caching on optimizations. More...
 
static CountergetCounter (const std::string &typ)
 Access counter object for local caching on optimizations. More...
 
template<class T >
static void increment (T *)
 Increment count according to type information. More...
 
template<class T >
static void decrement (T *)
 Decrement count according to type information. More...
 
template<class T >
static counter_t get (T *)
 Access current counter. More...
 
static void increment (const std::type_info &typ)
 Increment count according to type information. More...
 
static void decrement (const std::type_info &typ)
 Decrement count according to type information. More...
 
static counter_t get (const std::type_info &typ)
 Access current counter. More...
 
static void increment (const std::string &typ)
 Increment count according to string information. More...
 
static void decrement (const std::string &typ)
 Decrement count according to string information. More...
 
static counter_t get (const std::string &typ)
 Access current counter. More...
 
static void dump (int which=ALL)
 Dump list of instance counters. More...
 
static void clear (int which=ALL)
 Clear list of instance counters. More...
 
static bool doTrace ()
 Check if tracing is enabled. More...
 
static void doTracing (bool value)
 Enable/Disable tracing. More...
 

Detailed Description

Helper to support object counting when debugging memory leaks.

Small class to enable object construction/destruction tracing

Author
M.Frank
Version
1.0

Definition at line 31 of file InstanceCount.h.

Member Typedef Documentation

◆ counter_t

typedef long long int dd4hep::InstanceCount::counter_t

Definition at line 33 of file InstanceCount.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Enumeration to steer the output.

Enumerator
NONE 
STRING 
TYPEINFO 
ALL 

Definition at line 35 of file InstanceCount.h.

Constructor & Destructor Documentation

◆ InstanceCount()

InstanceCount::InstanceCount ( )

Standard Constructor - No need to call explicitly.

Standard Constructor.

Definition at line 64 of file InstanceCount.cpp.

◆ ~InstanceCount()

InstanceCount::~InstanceCount ( )
virtual

Standard Destructor - No need to call explicitly.

Standard destructor.

Definition at line 69 of file InstanceCount.cpp.

Member Function Documentation

◆ clear()

static void dd4hep::InstanceCount::clear ( int  which = ALL)
static

Clear list of instance counters.

◆ decrement() [1/3]

void InstanceCount::decrement ( const std::string &  typ)
static

Decrement count according to string information.

Definition at line 119 of file InstanceCount.cpp.

◆ decrement() [2/3]

void InstanceCount::decrement ( const std::type_info &  typ)
static

Decrement count according to type information.

Definition at line 139 of file InstanceCount.cpp.

◆ decrement() [3/3]

template<class T >
static void dd4hep::InstanceCount::decrement ( T *  )
inlinestatic

Decrement count according to type information.

Definition at line 102 of file InstanceCount.h.

◆ doTrace()

bool InstanceCount::doTrace ( )
static

Check if tracing is enabled.

Definition at line 85 of file InstanceCount.cpp.

◆ doTracing()

void InstanceCount::doTracing ( bool  value)
static

Enable/Disable tracing.

Definition at line 90 of file InstanceCount.cpp.

◆ dump()

void InstanceCount::dump ( int  which = ALL)
static

Dump list of instance counters.

Force dump of counter.

Definition at line 149 of file InstanceCount.cpp.

◆ get() [1/3]

static counter_t dd4hep::InstanceCount::get ( const std::string &  typ)
inlinestatic

Access current counter.

Definition at line 122 of file InstanceCount.h.

◆ get() [2/3]

static counter_t dd4hep::InstanceCount::get ( const std::type_info &  typ)
inlinestatic

Access current counter.

Definition at line 114 of file InstanceCount.h.

◆ get() [3/3]

template<class T >
static counter_t dd4hep::InstanceCount::get ( T *  )
inlinestatic

Access current counter.

Definition at line 106 of file InstanceCount.h.

◆ getCounter() [1/2]

InstanceCount::Counter * InstanceCount::getCounter ( const std::string &  typ)
static

Access counter object for local caching on optimizations.

Definition at line 101 of file InstanceCount.cpp.

◆ getCounter() [2/2]

InstanceCount::Counter * InstanceCount::getCounter ( const std::type_info &  typ)
static

Access counter object for local caching on optimizations.

Definition at line 95 of file InstanceCount.cpp.

◆ increment() [1/3]

void InstanceCount::increment ( const std::string &  typ)
static

Increment count according to string information.

Definition at line 109 of file InstanceCount.cpp.

◆ increment() [2/3]

void InstanceCount::increment ( const std::type_info &  typ)
static

Increment count according to type information.

Definition at line 129 of file InstanceCount.cpp.

◆ increment() [3/3]

template<class T >
static void dd4hep::InstanceCount::increment ( T *  )
inlinestatic

Increment count according to type information.

Definition at line 98 of file InstanceCount.h.


The documentation for this struct was generated from the following files: