Interfaces

COM interfaces have several facets.  First, an interface is a deferred, or an abstract, class.  This means that an interface is a specification of a type. Second, an interface pointer represents a COM object, which is callable by a client application. An object can expose several interfaces, or represent several types.

ECOM_INTERFACE

For each interface referenced in a type library, the EiffelCOM wizard generates a deferred class and two effective classes: a proxy of an interface pointer, or a client side class, and a stub of an interface pointer, or a server side class. The deferred interface class inherits from ECOM_INTERFACE and has a deferred feature per each interface function. Both effective classes, or implemented interfaces, inherit from the deferred class and implement its functions. The functions of the interface proxy call underlying C layer, which calls a COM component. The functions of the interface stub implement the component functionality.

ECOM_INTERFACE holds a pointer to the underlining COM interface.

ECOM_QUERIABLE

Different languages handle the type coercion in dissimilar ways. C has a type cast; C++ introduces several type casting mechanisms; Eiffel has an assignment attempt, etc. Every COM interface exposes QueryInterface function that allows a client to query the COM component for the interfaces it exposes and receive a pointer to another interface. Querying a component for an interface is similar to using an assignment attempt in Eiffel. The Eiffel implementation of the assignment attempt relies on the runtime data. Since we could not change the Eiffel runtime and the implementation of the assignment attempt, we have created a library class ECOM_QUERIABLE, which has a creation routine

make_from_other (other: ECOM_INTERFACE)

that queries a COM component internally. Every interface proxy class inherits from ECOM_QUERIABLE.

ECOM_STUB

ECOM_STUB inherits from ECOM_INTERFACE, and has feature create_item, which allows to create a COM object corresponding to an Eiffel object.