The Object Map and the CAtlModule Class

ATL uses two constructs to support the functionality all types of servers require: the object map and one of three CAtlModule-derived classes. As you'll see shortly, the behavior of a COM server differs considerably depending upon whether that server is an inproc server, a local server, or a Windows service. ATL has factored server functionality into CAtlDllModuleT, CAtlExeModuleT, and CAtlServiceModuleT, each of which extends the CAtlModule base class. The discussion that follows refers to CAtlModule directly, but you should realize that one of the derived classes actually does most of the work. The object map (more properly entitled a class map) is a table of all classes implemented in the server.

Various methods of the CAtlModule class use the object map to do the following:

  • Find each class and ask it to register and unregister itself

  • Create the class object, if any, for each createable class

  • Register and unregister the class objects with the SCM

  • Find a table of implemented and required component categories for a class

  • Call the static initialization and termination member functions for each class

The basic idea is that you describe the classes that you are implementing in a server using the object map. Whenever you need basic server functionality, there is probably a method of the CAtlModule class that implements much, if not all, of the required functionality.

Many methods in the CAtlModule class iterate over the entries in the object map and either ask each class to perform the required function or ask each class to provide the information needed to allow the method to do it.

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 © 2008-2017.
If you may any questions please contact us: