1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--Converted with LaTeX2HTML 2002-2-1 (1.70)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Basic Structure</TITLE>
<META NAME="description" CONTENT="Basic Structure">
<META NAME="keywords" CONTENT="users_guide">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="users_guide.css">
<LINK REL="next" HREF="node51.html">
<LINK REL="previous" HREF="node49.html">
<LINK REL="up" HREF="node49.html">
<LINK REL="next" HREF="node51.html">
</HEAD>
<BODY >
<DIV CLASS="navigation"><!--Navigation Panel-->
<A NAME="tex2html1372"
HREF="node51.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html1366"
HREF="node49.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html1360"
HREF="node49.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html1368"
HREF="node14.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<A NAME="tex2html1370"
HREF="node317.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1373"
HREF="node51.html">Comments and Doc-Comments</A>
<B> Up:</B> <A NAME="tex2html1367"
HREF="node49.html">SIDL Files</A>
<B> Previous:</B> <A NAME="tex2html1361"
HREF="node49.html">SIDL Files</A>
<B> <A NAME="tex2html1369"
HREF="node14.html">Contents</A></B>
<B> <A NAME="tex2html1371"
HREF="node317.html">Index</A></B>
<BR>
<BR></DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION02421000000000000000"></A><A NAME="1849"></A>
<BR>
Basic Structure
</H2>
<P>
The basic structure of a SIDL file is illustrated below.
<P>
<BR>
<PRE CLASS="verbatim">package <identifier> [version <version>]
{
interface <identifier> [ <inheritance> ]
{
[<type>] <identifier> ( [<parameters>] ) [throws <exception>];
.
.
.
[<type>] <identifier> ( [<parameters>] ) [throws <exception>];
}
class <identifier> [ <inheritance> ]
{
[<type>] <identifier> (<parameters>) [throws <exception>];
.
.
.
[<type>] <identifier> ( [<parameters>] ) [throws <exception>];
}
package <identifier> [version <version>]
{
.
.
.
}
}
</PRE></td></tr></table></blockquote>
<P>
The main elements are <SPAN CLASS="textit">packages</SPAN>, <SPAN CLASS="textit">interfaces</SPAN>, <SPAN CLASS="textit">classes</SPAN>,
<SPAN CLASS="textit">methods</SPAN>, and <SPAN CLASS="textit">types</SPAN>. For a more detailed description, refer to
Appendix <A HREF="node217.html#c:grammar">B</A>.
<P>
<DL>
<DT><STRONG>Packages</STRONG></DT>
<DD><A NAME="1858"></A><A NAME="1859"></A>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 <SPAN CLASS="textit">package</SPAN> keyword, packages
have a <SPAN CLASS="textit">scoped</SPAN> 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<A NAME="1862"></A>. In order to make them non-re-entrant, they must be declared as
<TT><I CLASS="slanted">final</I></TT>.<A NAME="1864"></A><A NAME="1865"></A>
<P>
</DD>
<DT><STRONG>Interfaces</STRONG></DT>
<DD><A NAME="1866"></A><A NAME="1867"></A>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.
<P>
</DD>
<DT><STRONG>Classes</STRONG></DT>
<DD><A NAME="1868"></A><A NAME="1869"></A> 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.
<P>
</DD>
<DT><STRONG>Methods</STRONG></DT>
<DD><A NAME="1870"></A><A NAME="1871"></A> define services
that are available for invocation by a caller. The signature of the
method consists of the return <SPAN CLASS="textit">type</SPAN>, identifier, arguments, and
exceptions. Each parameter has a <SPAN CLASS="textit">type</SPAN> and a
<SPAN CLASS="textit">mode</SPAN><A NAME="1875"></A>. The <SPAN CLASS="textit">mode</SPAN> indicates whether the value
of the specified <SPAN CLASS="textit">type</SPAN> is passed from caller to callee
(<SPAN CLASS="textit">in</SPAN><A NAME="1879"></A>), from callee to caller (<SPAN CLASS="textit">out</SPAN><A NAME="1881"></A>),
or both (<SPAN CLASS="textit">inout</SPAN><A NAME="1883"></A>). Each exception that a method can
<SPAN CLASS="textit">throw</SPAN><A NAME="1885"></A> when it detects an error must be listed.
These exceptions can be either interfaces or classes so long as they
inherit from<A NAME="1886"></A>
<TT><I CLASS="slanted">sidl.BaseException</I></TT><A NAME="1888"></A><A NAME="1889"></A>.
For a default implementation of the exception interfaces, the
exception classes should extend
<TT><I CLASS="slanted">sidl.SIDLException</I></TT><A NAME="1891"></A><A NAME="1892"></A>.
Methods and parameter passing modes are discussed in greater detail in
Section <A HREF="node105.html#sec:basics:objects:methods">5.6</A>.
<P>
</DD>
<DT><STRONG>Types</STRONG></DT>
<DD><A NAME="1894"></A><A NAME="1895"></A> are used to constrain the the values of parameters, exceptions,
and return values associated with methods. SIDL supports basic types such as
<TT><I CLASS="slanted">int</I></TT>, <TT><I CLASS="slanted">bool</I></TT>, and <TT><I CLASS="slanted">long</I></TT> as well as strings, complex numbers,
and arrays.
<P>
</DD>
</DL>
<P>
<DIV CLASS="navigation"><HR>
<!--Navigation Panel-->
<A NAME="tex2html1372"
HREF="node51.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html1366"
HREF="node49.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html1360"
HREF="node49.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html1368"
HREF="node14.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<A NAME="tex2html1370"
HREF="node317.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1373"
HREF="node51.html">Comments and Doc-Comments</A>
<B> Up:</B> <A NAME="tex2html1367"
HREF="node49.html">SIDL Files</A>
<B> Previous:</B> <A NAME="tex2html1361"
HREF="node49.html">SIDL Files</A>
<B> <A NAME="tex2html1369"
HREF="node14.html">Contents</A></B>
<B> <A NAME="tex2html1371"
HREF="node317.html">Index</A></B> </DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<br><br>babel-0.10.2<br>users_guide Last Modified 2005-03-23<br><br><a href="http://www.llnl.gov/CASC/components">http://www.llnl.gov/CASC/components</a><br><a href="mailto:components@llnl.gov">components@llnl.gov</a>
</ADDRESS>
</BODY>
</HTML>
|