Microsoft DirectX 8.1 (C++)

CBaseObject Class

The CBaseObject class is an abstract class for implementing Microsoft® DirectShow® objects. To implement Component Object Model (COM) objects, use the CUnknown class, which derives from CBaseObject.

Most of the DirectShow classes derive from CBaseObject. This class provides debugging assistance by keeping a count of all the DirectShow objects active during run time. The object count is stored in a class-static member variable:

class CBaseObject
{
private:
    static LONG m_cObjects;  // Total number of objects active. 
/* ... */
};

In debug builds, the DLL will assert if it is unloaded while the object count is greater than zero. This makes it easier to track down leaks caused by reference-counting problems.

The CObject constructor takes one argument, a debugging name for the object. This name is stored in a global table in the DLL. The DbgDumpObjectRegister function formats a list of the objects active in the DLL, and sends it to the debug output.

Requirements

Header: Declared in Combase.h; include Streams.h.

Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

Class Methods  
CBaseObject Constructor method.
~CBaseObject Destructor method.
ObjectsActive Retrieves the count of active objects.