previous page
next page

The Layers of ATL

ATL's support for building COM objects is separated into several layers, as shown in Figure 4.1.

Figure 4.1. The layers of ATL


These layers break down into services exposed by ATL for building objects:

  1. CComObjectRootEx uses a CComXxxThreadModel to provide "just thread-safe enough" object lifetime management and object locking.

  2. CComObjectRootBase and CComObjectRootEx provide helper functions used in implementing IUnknown.

  3. Your class, which derives from CComObjectRootEx, also derives from any interfaces it wants to implement, as well as providing the method implementations. You or one of the ATL IXxxImpl classes can provide method implementations.

  4. CComObject et al, provides the actual implementation of the methods of IUnknown in a way consistent with your desires for object and server lifetime management requirements. This final layer actually derives from your class.

Your choice of base classes and the most derived class determines the way the methods of IUnknown are implemented. If your choices change, using different classes at compile time (or runtime) will change how ATL implements IUnknown, independently of the rest of the behavior of your object. The following sections explore each layer of ATL.


previous page
next page
Converted from CHM to HTML with chm2web Pro 2.75 (unicode)