Basic Structure
The basic structure of a SIDL file is illustrated below.
package <identifier> [version <version>]
{
interface <identifier> [ <inheritance> ]
{
[<type>] <identifier> ( [<parameters>] ) [throws <exception>];
[require <contract-clause>]
[ensure <contract-clause>]
.
.
.
[<type>] <identifier> ( [<parameters>] ) [throws <exception>];
[require <contract-clause>]
[ensure <contract-clause>]
}
class <identifier> [ <inheritance> ]
{
[<type>] <identifier> (<parameters>) [throws <exception>];
[require <contract-clause>]
[ensure <contract-clause>]
.
.
.
[<type>] <identifier> ( [<parameters>] ) [throws <exception>];
[require <contract-clause>]
[ensure <contract-clause>]
}
package <identifier> [version <version>]
{
.
.
.
}
}
The main elements are packages, interfaces, classes,
methods, types, and contract clauses. For a more
detailed description, refer to Appendix B.
- Packages
- provide a mechanism for specifying name space hierarchies.
That is, it enables grouping sets of interface and/or class descriptions as
well as nested packages. Identified by the package keyword, packages
have a scoped name that consists of one or more identifiers, or name
strings, separated by a period (``.''). A package can contain multiple
interfaces, classes and nested packages. By default, packages are now
re-entrant. In order to make them non-re-entrant, they must be declared as
final.
- Interfaces
- define a set of methods that a caller can invoke on an
object of a class that implements the methods. Multiple inheritance of
interfaces is supported, which means an interface or a class can be derived from one
or more interfaces.
- Classes
- also define a set of methods that a caller can invoke on an
object. A class can extend only one other class but it can implement multiple
interfaces. So we have single inheritance of classes and multiple inheritance
of interfaces.
- Methods
- define services
that are available for invocation by a caller. The signature of the
method consists of the return type, identifier, arguments, and
exceptions. Each parameter has a type and a
mode. The mode indicates whether the value
of the specified type is passed from caller to callee
(in), from callee to caller (out),
or both (inout). All methods are implicitly
capable of throwing a sidl.RuntimeException exception.
A sidl.RuntimeException is used to indicate an error
in the Babel generated code or potentially a network exception. Each
additional exception that a method can throw when
it detects an error must be listed. These exceptions can be either
interfaces or classes so long as they inherit
from
sidl.BaseException.
For a default implementation of the exception interfaces, the
exception classes should extend
sidl.SIDLException.
Methods and parameter passing modes are discussed in greater detail in
Section 5.7.
- Types
- are used to constrain the the values of parameters, exceptions,
and return values associated with methods. SIDL supports basic types such as
int, bool, and long as well as strings, complex
numbers, classes, and arrays.
- Contract clauses
- are used
to define properties that must hold before and/or after method invocation.
babel-1.4.0
users_guide Last Modified 2008-10-16
http://www.llnl.gov/CASC/components
components@llnl.gov