CountedObject< Obj > Class Template Reference

CountedObject< Obj > Class Template Reference

#include <CountedObject.h>

Class Description

template<class Obj>
class CountedObject< Obj >

This class is derived from in order to automatically count the number of existing instances, and at shutdown write to Debug Output the leakage count for the class.

The template class Obj should be set to class deriving from this class. For example: class ParamBlock2PostLoadInfo : public IParamBlock2PostLoadInfo, private CountedObject<ParamBlock2PostLoadInfo> On shutdown, with 0 leakage, the output to Debug Output would be: Leakage count** class ParamBlock2PostLoadInfo: 0

Public Member Functions

 CountedObject ()
 
 CountedObject (const CountedObject &)
 
 ~CountedObject ()
 

Static Public Member Functions

static unsigned __int64 GetObjectCount ()
 Returns the current number of class instances. More...
 

Constructor & Destructor Documentation

CountedObject ( )
inline
30 { GetCounter()++; }
CountedObject ( const CountedObject< Obj > &  )
inline
31 { GetCounter()++; }
~CountedObject ( )
inline
32 { GetCounter()--; }

Member Function Documentation

static unsigned __int64 GetObjectCount ( )
inlinestatic

Returns the current number of class instances.

36 { return GetCounter(); }