Summary


ATL provides a layered approach to implementing IUnknown. The top layer, represented by the CComXxxThreadModel classes, provides helper functions and type definitions for synchronization required of both STAs and MTAs. The second level, CComObjectRootEx, uses the threading model classes to support "just thread-safe enough" AddRef and Release implementations and object-level locking. CComObject-RootEx also provides a table-driven implementation of QueryInterface, using an interface map provided by your class. Your class derives from CComObjectRootEx and any number of interfaces, providing the interface member function implementations. The final level is provided by CComObject and friends, which provide the implementation of QueryInterface, AddRef, and Release based on the lifetime and identity requirements of the object.

To allow each class to define its one lifetime and identity requirements, each class defines its own _CreatorClass, which defines the appropriate Creator. The Creator is responsible for properly creating an instance of your ATL-base class and should be used in place of the C++ operator new.

Finally, to debug your objects, ATL provides a number of debugging facilities, including tracing and interface usage and leak tracking.




ATL Internals. Working with ATL 8
ATL Internals: Working with ATL 8 (2nd Edition)
ISBN: 0321159624
EAN: 2147483647
Year: 2004
Pages: 172

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net