List of all members | Public Types | Static Public Member Functions | Protected Member Functions | Static Private Attributes
utl::CountedObject< T > Class Template Reference

Mix-in class for counting creation and destruction of objects. More...

#include "utl/CountedObject.h"

Inheritance diagram for utl::CountedObject< T >:
Inheritance graph
[legend]

Public Types

typedef T CountedType
 The type of the object we are counting. More...
 
typedef
CountedObjectRegistry::Counter 
Counter
 The (integer) type used to hold the counter. More...
 

Static Public Member Functions

static Counter GetObjectsAssigned ()
 
static Counter GetObjectsCopied ()
 
static Counter GetObjectsCreated ()
 number of calls to the constructor More...
 
static Counter GetObjectsDestroyed ()
 number of calls to the destructor More...
 
static Counter GetObjectsExisting ()
 difference of number of calls to constructor and destructor More...
 

Protected Member Functions

 CountedObject ()
 
 CountedObject (const CountedObject &)
 
CountedObjectoperator= (const CountedObject &)
 
virtual ~CountedObject ()
 

Static Private Attributes

static Counter fgObjectsAssigned = 0
 
static Counter fgObjectsCopied = 0
 
static Counter fgObjectsCreated = 0
 
static Counter fgObjectsDestroyed = 0
 

Detailed Description

template<class T>
class utl::CountedObject< T >

Mix-in class for counting creation and destruction of objects.

This template adds two global, static variables per type that is counted to count the calls to the constructor and destructor.

To instrument the code using this class, you inherit privately from this class

class Object : private CountedObject<Object> {
};
Author
Lukas Nellen
Date
13 Jan 2004

Definition at line 30 of file CountedObject.h.

Member Typedef Documentation

template<class T>
typedef T utl::CountedObject< T >::CountedType

The type of the object we are counting.

Definition at line 33 of file CountedObject.h.

The (integer) type used to hold the counter.

Definition at line 35 of file CountedObject.h.

Constructor & Destructor Documentation

template<class T>
utl::CountedObject< T >::CountedObject ( )
inlineprotected

Definition at line 52 of file CountedObject.h.

template<class T>
utl::CountedObject< T >::CountedObject ( const CountedObject< T > &  )
inlineprotected

Definition at line 58 of file CountedObject.h.

template<class T>
virtual utl::CountedObject< T >::~CountedObject ( )
inlineprotectedvirtual

Definition at line 65 of file CountedObject.h.

Member Function Documentation

template<class T>
static Counter utl::CountedObject< T >::GetObjectsAssigned ( )
inlinestatic

Definition at line 48 of file CountedObject.h.

template<class T>
static Counter utl::CountedObject< T >::GetObjectsCopied ( )
inlinestatic

Definition at line 45 of file CountedObject.h.

template<class T>
static Counter utl::CountedObject< T >::GetObjectsCreated ( )
inlinestatic

number of calls to the constructor

Definition at line 38 of file CountedObject.h.

template<class T>
static Counter utl::CountedObject< T >::GetObjectsDestroyed ( )
inlinestatic

number of calls to the destructor

Definition at line 40 of file CountedObject.h.

template<class T>
static Counter utl::CountedObject< T >::GetObjectsExisting ( )
inlinestatic

difference of number of calls to constructor and destructor

Definition at line 42 of file CountedObject.h.

template<class T>
CountedObject& utl::CountedObject< T >::operator= ( const CountedObject< T > &  )
inlineprotected

Definition at line 67 of file CountedObject.h.

Member Data Documentation

template<class T>
CountedObject< T >::Counter utl::CountedObject< T >::fgObjectsAssigned = 0
staticprivate
template<class T>
CountedObject< T >::Counter utl::CountedObject< T >::fgObjectsCopied = 0
staticprivate
template<class T>
CountedObject< T >::Counter utl::CountedObject< T >::fgObjectsCreated = 0
staticprivate
template<class T>
CountedObject< T >::Counter utl::CountedObject< T >::fgObjectsDestroyed = 0
staticprivate

The documentation for this class was generated from the following file:

, generated on Tue Sep 26 2023.