Overloaded methods

Using the overload_sample.sidl file from Section 5.7 as an example, recall that three versions of the getValue method are specified. The first signature takes no arguments, the second takes an integer, and the third a boolean. The code snippet below illustrates object creation, method invocation for each of the overloaded methods, and exception handling.


  int32_t b1, i1, iresult, nresult;
  sidl_BaseInterface ex;

  Overload_Sample t  = Overload_Sample__create (&ex); SIDL_CHECK(ex);

  nresult = Overload_Sample_getValue(t, &ex); SIDL_CHECK(ex);
  iresult = Overload_Sample_getValueInt(t, i1, &ex); SIDL_CHECK(ex);
  bresult = Overload_Sample_getValueBool(t, b1, &ex); SIDL_CHECK(ex);

SIDL_CHECK is used to check if an exception has been thrown. If so, control jumps to the code after the EXIT label, which is not illustrated here but is in the example presented in Subsection 6.3.6.





babel-1.4.0
users_guide Last Modified 2008-10-16

http://www.llnl.gov/CASC/components
components@llnl.gov