File: node52.html

package info (click to toggle)
babel 0.10.2-1
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 43,932 kB
  • ctags: 29,707
  • sloc: java: 74,695; ansic: 73,142; cpp: 40,649; sh: 18,411; f90: 10,062; fortran: 6,727; python: 6,406; makefile: 3,866; xml: 118; perl: 48
file content (192 lines) | stat: -rw-r--r-- 7,191 bytes parent folder | download | duplicates (2)
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
<!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>Packages and Versions</TITLE>
<META NAME="description" CONTENT="Packages and Versions">
<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="node53.html">
<LINK REL="previous" HREF="node51.html">
<LINK REL="up" HREF="node49.html">
<LINK REL="next" HREF="node53.html">
</HEAD>

<BODY >

<DIV CLASS="navigation"><!--Navigation Panel-->
<A NAME="tex2html1400"
  HREF="node53.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1394"
  HREF="node49.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1388"
  HREF="node51.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1396"
  HREF="node14.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1398"
  HREF="node317.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1401"
  HREF="node53.html">Re-entrant Packages</A>
<B> Up:</B> <A NAME="tex2html1395"
  HREF="node49.html">SIDL Files</A>
<B> Previous:</B> <A NAME="tex2html1389"
  HREF="node51.html">Comments and Doc-Comments</A>
 &nbsp; <B>  <A NAME="tex2html1397"
  HREF="node14.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1399"
  HREF="node317.html">Index</A></B> 
<BR>
<BR></DIV>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION02423000000000000000"></A><A NAME="1913"></A><A NAME="1914"></A><A NAME="1915"></A>
<BR>
Packages and Versions
</H2>

<P>
SIDL has both a packaging and versioning mechanism built in.  
Packages are essentially named scopes, serving a similar function
as Java packages or C++ namespaces.  Versions
are decimal separated integer values where it is assumed
larger numbers imply more recent versions. All classes 
and interfaces in that package get that same 
version number.  If subpackages are specified, they can have their own version 
number assigned.  If a package is declared without a version, it can only 
contain other packages.  If a package declares interfaces or classes,
a version number for that package is required.

<P>
<BR>
<PRE  CLASS="verbatim">package mypkg { 

}
</I></PRE></td></tr></table></blockquote>This SIDL file represents the minimum needed for each and every SIDL
file.  The package statement defines a scope where all
classes within the package must reside.  Since no version clause is included, 
the version number defaults to 0.

<P>
Packages can be nested.<A NAME="1917"></A> This is shown in the example below.  The version 
numbers assigned to all the types is determined by the package, or subpackage, 
in which it resides.  In the design of the SIDL file, remember that
some languages get very long function names from excessively nested packages
or excessively long package names.
<BR>
<PRE  CLASS="verbatim">package mypkg version 1.0 { 

  package thisIsAReallyLongPackageName { 
  }
  
  package this version 0.6 { 
    package is {
      package a { 
        package really { 
          package deeply version 0.4 {
            package nested {
              package packageName version 0.1 {
              }
            }
          }
        }
      }
    }
  }
}

</I></PRE></td></tr></table></blockquote>
<P>
External types can be expressed in one of two ways.  The fully
scoped<A NAME="1919"></A>
external type can be used anywhere in the class description.  Alternatively, 
an <TT><I CLASS="slanted">import</I></TT><A NAME="1921"></A><A NAME="1922"></A> statement can be used to put the type in the local
package-space.  <TT><I CLASS="slanted">import</I></TT> statements can request a specific
version of the package, if that version is not found, Babel will print
an error.  If no version is specified, Babel will take whatever
version it is being run on.  Babel can not be run on two versions of
a given package at the same time, even if you only import or require
one of them.  

<P>
Another way to restrict the package version you use is the <TT><I CLASS="slanted">restrict</I></TT><A NAME="1925"></A><A NAME="1926"></A> statement.
<TT><I CLASS="slanted">restrict</I></TT> does not import the package, but if you do later
import the package or refer to something in that package by it's fully
scoped name, Babel will guarantee that the correct version of the
package will be used.  Also note that all restrict statements must come before
the first import statement.

<P>
Below is a sample SIDL file, that should help bring all of these concepts
together.

<P>
<BR>
<PRE  CLASS="verbatim">require pkgC version 2.0; // restrict pkgC to version 2.0, not imported

import pkgA version 1.0; // restrict pkgA version 1.0. Includes class pkgA.A

import pkgB;      // import pkgB regaurdless of version.  Includes class pkgB.B

package mypkg version 2.0 { 
  class foo { 
    setA( A ); // imported from pkgA, must be pkgA.A-v1.0
    setB( B ); // imported from pkgB, must be pkgB.B, no version restriction
    setC( pkgC.C ); // must be pkgC.C-v2.0
    setD( pkgD.D ); // no version restriction
  }
}
</I></PRE></td></tr></table></blockquote>
<P>

<DIV CLASS="navigation"><HR>
<!--Navigation Panel-->
<A NAME="tex2html1400"
  HREF="node53.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html1394"
  HREF="node49.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html1388"
  HREF="node51.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html1396"
  HREF="node14.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html1398"
  HREF="node317.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1401"
  HREF="node53.html">Re-entrant Packages</A>
<B> Up:</B> <A NAME="tex2html1395"
  HREF="node49.html">SIDL Files</A>
<B> Previous:</B> <A NAME="tex2html1389"
  HREF="node51.html">Comments and Doc-Comments</A>
 &nbsp; <B>  <A NAME="tex2html1397"
  HREF="node14.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html1399"
  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>