Previous Table of Contents Next


19.4.1 A Complete IDL to ODL Mapping for the Basic Data Types


   There is no requirement that the OMG IDL code expressing the mapped CORBA interface actually exists. Other equivalent expressions of CORBA interfaces, such as the contents of an Interface Repository, may be used. Moreover, there is no requirement that ODL code corresponding to the CORBA interface be generated.

   However, OMG IDL is the appropriate medium for describing a CORBA interface and ODL is the appropriate medium for describing an Automation View Interface. Therefore, the following OMG IDL code describes a CORBA interface that exercises all of the CORBA base data types in the roles of attribute, operation in parameter, operation out parameter, operation inout parameter, and return value. The OMG IDL code is followed by ODL code describing the Automation View Interface that would result from a conformant mapping.

   module MyModule // OMG IDL

   { interface TypesTest {

   attribute boolean boolTest; attribute char charTest; attribute double doubleTest; attribute float floatTest; attribute long longTest; attribute octet octetTest; attribute short shortTest; attribute string stringTest; attribute string<10>stringnTest; attribute unsigned long ulongTest; attribute unsigned short ushortTest;

   readonly attribute short readonlyShortTest;

   // Sets all the attributes

   boolean setAll ( in boolean boolTest, in char charTest, in double doubleTest, in float floatTest, in long longTest, in octet octetTest, in short shortTest, in string stringTest, in string<10> stringnTest, in unsigned long ulongTest, in unsigned short ushortTest);

   // Gets all the attributes boolean boolReturn (); char charReturn (); double doubleReturn(); float floatReturn(); long longReturn (); octet octetReturn(); short shortReturn (); string stringReturn(); string<10> stringnReturn(); unsigned long ulongReturn (); unsigned short ushortReturn();

boolean getAll (

out boolean

out char

out double

out float

out long

out octet

out short

out string

out string<10>

out unsigned long

out unsigned short

boolean setAndIncrement (

inout boolean

inout char

inout double

inout float

inout long

inout octet

inout short

inout string

inout string<10>

inout unsigned long

inout unsigned short

boolTest,
charTest,
doubleTest,
floatTest,
longTest,
octetTest,
shortTest,
stringTest,
stringnTest,
ulongTest,
ushortTest);
boolTest,
charTest,
doubleTest,
floatTest,
longTest,
octetTest,
shortTest,
stringTest,
stringnTest,
ulongTest,
ushortTest);

   }; // End of Interface TypesTest

   }; // End of Module MyModule

   The corresponding ODL code is as follows.

   [odl, dual, uuid(180d4c5a-17d2-a1a8-1de1-82e7a9a4f93b)]interface DIMyModule_TypesTest: IDispatch {HRESULT boolReturn ([optional,out] VARIANT * excep_OBJ,[retval,out] short *val);HRESULT charReturn ([optional,out] VARIANT * excep_OBJ,[retval,out] short *val);HRESULT doubleReturn ([optional,out] VARIANT * excep_OBJ, [retval,out] double *val);

   HRESULT floatReturn ([optional,out] VARIANT * excep_OBJ, [retval,out] float *val);

   HRESULT getAll ([out] short *boolTest,[out] short *charTest, [out] double *doubleTest, [out] float *floatTest,[out] long *longTest, [out] short *octetTest,[out] short *shortTest,[out] BSTR stringTest, [out] BSTR *stringnTest, [out] long *ulongTest, [out] long *ushortTest,[optional,out] VARIANT * excep_OBJ, [retval,out] short * val);

   HRESULT longReturn ([optional,out] VARIANT * excep_OBJ,[retval,out] long *val);HRESULT octetReturn ([optional,out] VARIANT * excep_OBJ, [retval,out] short *val);

   HRESULT setAll ([in] short boolTest, [in] short charTest,[in] double doubleTest,[in] float floatTest, [in] long longTest,[in] short octetTest,[in] short shortTest, [in] BSTR stringTest,[in] BSTR stringnTest, [in] long ulongTest,[in] long ushortTest, [optional,out] VARIANT * excep_OBJ, [retval,out] short * val);

   HRESULT setAndIncrement ([in,out] short *boolTest,[in,out] short *charTest,[in,out] double *doubleTest,[in,out] float *floatTest, [in,out] long *longTest, [in,out] short *octetTest,[in,out] short *shortTest, [in,out] BSTR *stringTest, [in,out] BSTR *stringnTest,[in,out] long *ulongTest, [in,out] long *ushortTest, [optional,out] VARIANT * excep_OBJ, [retval,out] short *val);

   HRESULT shortReturn ([optional,out] VARIANT * excep_OBJ, [retval,out] short *val);HRESULT stringReturn ([optional,out] VARIANT * excep_OBJ, [retval,out] BSTR *val);HRESULT stringnReturn ([optional,out] VARIANT * exep_OBJ, [retval,out] BSTR *val);HRESULT ulongReturn ([optional,out] VARIANT * excep_OBJ, [retval,out] long *val);HRESULT ushortReturn ([optional,out] VARIANT * excep_OBJ, [retval,out] long *val);

   [propget] HRESULT boolTest([retval,out] short *val);[propput] HRESULT boolTest([in] short boolTest);[propget] HRESULT charTest([retval,out] short *val);[propput] HRESULT charTest([in] short charTest);[propget] HRESULT doubleTest([retval,out] double *val);[propput] HRESULT doubleTest([in] double doubleTest);[propget] HRESULT floatTest([retval,out] float *val);[propput] HRESULT floatTest([in] float floatTest);[propget] HRESULT longTest([retval,out] long *val);[propput] HRESULT longTest([in] long longTest);[propget] HRESULT octetTest([retval,out] short *val);[propput] HRESULT octetTest([in] short octetTest);[propget] HRESULT readonlyShortTest([retval,out] short *val);[propget] HRESULT shortTest([retval,out] short *val);[propput] HRESULT shortTest([in] short shortTest);[propget] HRESULT stringTest([retval,out] BSTR *val);[propput] HRESULT stringTest([in] BSTR stringTest);[propget] HRESULT stringnTest([retval,out] BSTR *val);[propput] HRESULT stringnTest([in] BSTR stringnTest);[propget] HRESULT ulongTest([retval,out] long *val);[propput] HRESULT ulongTest([in] long ulongTest);[propget] HRESULT ushortTest([retval,out] long *val);[propput] HRESULT ushortTest([in] long ushortTest);

   }