Operations in an IDL interface become component methods when the interface is assigned to a component. Operations are declared as follows:
returnType opName ( [ ... parameterList ... ] ) [ raises ( ... exceptionList ... ) ] ;
where:
returnType is either a valid IDL datatype or void to indicate that the operation does not return a value. “Datatypes for parameters and return values” discusses datatypes in detail.
opName is the name of the operation. Sybase recommends operation names begin with a lowercase letter. Names in the same interface must be unique with respect to case, and capitalization of a name must be consistent wherever it is used.
IDL operation names cannot be overloaded (that is, redeclared with the same return type and different parameter lists). However, you can define IDL operations that map to overloaded C++ or Java methods. To do so, create operation names by appending two underscores and a unique suffix to the method name that will be overloaded. EAServer strips the suffix when generating C++ or Java interface definitions. For example, consider the following IDL:
void ov1__double(in double d); void ov1__string(in long l);
When mapped to C++ or Java, these operations translate to the following overloaded methods:
void ov1(double d); void ov1(long l);
parameterList is an optional parameter list enclosed in parentheses. The list (but not the parentheses) can be omitted to indicate that the operation takes no parameters. Otherwise, add datatypes and parameter names as shown below:
void myMethod ( qual1 type1 param1, qual2 type2 param2, ... );
where:
qual1, qual2, and so forth are one of the argument modes in, inout, or out. Use in for parameters that are input-only; no new value is returned when the operation completes. Use inout or out if the operation returns new values for the parameter. An inout parameter’s input value is meaningful; an out parameter’s input value is not.
type1, type2, and so forth are valid IDL type names (other than the CORBA::Any type). “Datatypes for parameters and return values” discusses datatypes in detail.
param1, param2, and so forth are parameter names.
exceptionList is an optional list of user-defined exceptions. If the operation can throw user-defined exceptions, add a raises clause with a list of the IDL user-defined exception names that the operation can throw, as shown below:
void myMethod ( in int n ) raises ( Exception1, Exception2, ... );
If the operation can throw only CORBA standard exceptions, omit the raises clause. For more information, see “User-defined exceptions”.