Online Eiffel Documentation |
Documentation Home > Class Libraries > EiffelCOM > EiffelCOM Content |
EiffelStudio |
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 clientapplication. An object can expose several interfaces, or represent several types.
For each interface listed in a type library, the EiffelCOM wizard generates a deferred classand two effective classes: a proxy of an interface pointer, or a client side class, and a stubof an interface pointer, or a server side class. The deferred interface class inherits fromECOM_INTERFACEand has a deferred feature per each interface function. Both effective classes, or implementedinterfaces, inherit from the deferred class and implement its functions. The functions of theinterface proxy calls the underlying C layer, which in turn calls the COM component whilethe functions of the interface stub implement the component functionality.
ECOM_INTERFACEholds a pointer to the underlying COM interface.
Different languages handle type coercion in different ways. C uses type cast; C++ introducesseveral type casting mechanisms; Eiffel uses assignment attempt, etc. Every COM interface exposesthe QueryInterface function which allows clients to query the COMcomponent for a pointer to another interface. Querying a component for an interface pointer issimilar to using an assignment attempt in Eiffel. The Eiffel implementation of the assignmentattempt relies on the runtime data. Since changing the Eiffel runtime and theimplementation of the assignment attempt was not an option, EiffelCOM introduces a library classECOM_QUERIABLE, which has the creation routine
make_from_other (other: ECOM_INTERFACE)
which queries a COM component internally. Every interface proxy class inherits fromECOM_QUERIABLE.The one difference between this mechanism versus using assignment attempt is that upon failure anexception will be raised. An assignment attempt that fails simply returns Void.
ECOM_STUBinherits fromECOM_INTERFACE, and exposes the feature create_item which allows creating the underlying COM object.
Copyright 1993-2006 Eiffel Software. All rights reserved. |