|
||
For plug-ins that work with ECom, an interface definition serves two purposes:
it defines functions that offer services to clients. These functions are typically pure virtual. Implementations derive from the interface to provide concrete functionality.
it offers object instantiation functions. Such a function does not create an instance of the interface definition class itself: instead, it uses ECom to create an instance of an appropriate implementation, and returns that to the client. The interface's destructor similarly notifies ECom that the object is destroyed.
This dual role is illustrated in the following diagram:
Typically, the interface definition provides to ECom an indication of which of the available implementations should be used. This indication can be very explicit, such as a UID that identifies a particular implementation, or indirect, such as data to match against an implementation's self-description.
This selection process is called resolution, and the entity that performs it a resolver. ECom provides a default resolver, but interface definitions can provide their own specialised resolvers where required.