3ds Max C++ API Reference
Loading...
Searching...
No Matches
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 uint64_t GetObjectCount ()
 Returns the current number of class instances.
 

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 typically be set to the 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 uint64_t GetObjectCount ( )
inlinestatic

Returns the current number of class instances.

36{ return GetCounter(); }