3ds Max C++ API Reference
CountedObject< Obj > Class Template Reference

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. More...

#include <CountedObject.h>

Public Member Functions

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

Static Public Member Functions

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

Detailed 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

Constructor & Destructor Documentation

◆ CountedObject() [1/2]

CountedObject ( )
inline
30 { GetCounter()++; }

◆ CountedObject() [2/2]

CountedObject ( const CountedObject< Obj > &  )
inline
31 { GetCounter()++; }

◆ ~CountedObject()

~CountedObject ( )
inline
32 { GetCounter()--; }

Member Function Documentation

◆ GetObjectCount()

static unsigned __int64 GetObjectCount ( )
inlinestatic

Returns the current number of class instances.

36 { return GetCounter(); }