Milestone Refactoring

Completed 11 years ago (2009-05-11 19:18:29)


Number of tickets:

15 / 15


4 / 4

A better approach would be to refactor the existing code (v1.07) to create interface loggers as well as PMC loggers. Each individual Logger inherits the one interface whose methods it supports. A PMC Logger is then constructed by inheriting its unique interfaces - i.e. those not shared with any other type of PMC - and by aggregating the loggers for the shared interfaces to produce a component that looks like the diagram shown on the right. The PMC Logger can still use COMQuery to intercept QueryInterface calls, but it will have to be changed to return the interface from the appropriate aggregated object if the requested interface is implemented in that way. The aggregated objects should be constructed in the PMC Loggers FinalConstuct call (or on demand when they are required) and should have the IUnknown interface of the PMC Logger passed as the pUnkOuter (i.e. the first) argument to the CreateInstance call. This will ensure that if QueryInterface is called on one of the aggregated loggers the call will be passed back to the PMC Logger so that the correct interface can be returned. \r\n\r\nThe advantages of this approach are:\r\n- Much less code\r\n- Changes to common interfaces only need to be done in one place\r\n- Creating new loggers or extending existing ones (for example with error logging support) will be much faster\r\n- The output and testing done for a particular interface will be consistent wherever it is used.

Note: See TracRoadmap for help on using the roadmap.