Previous Table of Contents Next


19.2.1 Mapping for Attributes and Operations


   An OMG IDL operation maps to an isomorphic Automation operation. An OMG IDL attribute maps to an ODL property, which has one method to get and one to set the value of the property. An OMG IDL readonly attribute maps to an OLE property, which has a single method to get the value of the property.

   The order of the property and method declarations in the mapped Automation interface follows the rules described in “Ordering Rules for the CORBA->OLE Automation Transformation? part of Section 17.5.2, “Detailed Mapping Rules,? on page 17-13.

   For example, given the following CORBA interface,

   interface account // OMG IDL

   { attribute float balance; readonly attribute string owner; void makeLodgement(in float amount, out float balance); void makeWithdrawal(in float amount, out float balance);

   };

   the corresponding Automation View Interface is:

   [odl, dual, uuid(...)]interface DIaccount: IDispatch{ // ODL

   HRESULT makeLodgement( [in] float amount,[out] float * balance, [optional, out] VARIANT * excep_OBJ);HRESULT makeWithdrawal( [in] float amount,[out] float * balance,

   [optional, out] VARIANT * excep_OBJ);[propget] HRESULT balance( [retval,out] float * val);[propput] HRESULT balance( [in] float balance);[propget] HRESULT owner( [retval,out] BSTR * val);

   }

   OMG IDL in, out, and inout parameters map to ODL [in], [out], and [in,out] parameters, respectively. Section 19.3, “Mapping for Basic Data Types,? on page 19-9, explains the mapping for basic data types. The mapping for CORBA oneway operations is the same as for normal operations.

   An operation of a Dual Interface always returns HRESULT, but the last argument in the operation’s signature may be tagged [retval,out]. An argument tagged in this fashion is considered syntactically to be a return value. Automation controller macro languages map this special argument to a return value in their language syntax. Thus, a CORBA operation’s return value is mapped to the last argument in the corresponding operation of the Automation View Interface.

   Additional, Optional Parameter

   All operations on the Automation View Interface have an optional out parameter of type VARIANT. The optional parameter returns explicit exception information in the context of each property set/get or method invocation. See Section 19.8.9, “Mapping CORBA Exceptions to Automation Exceptions,? on page 19-30 for a detailed discussion of how this mechanism works.

   If the CORBA operation has no return value, then the optional parameter is the last parameter in the corresponding Automation operation. If the CORBA operation does have a return value, then the optional parameter appears directly before the return value in the corresponding Automation operation, since the return value must always be the last parameter.