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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
|
<!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>The Array API</TITLE>
<META NAME="description" CONTENT="The Array API">
<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="node98.html">
<LINK REL="previous" HREF="node64.html">
<LINK REL="up" HREF="node59.html">
<LINK REL="next" HREF="node66.html">
</HEAD>
<BODY >
<DIV CLASS="navigation"><!--Navigation Panel-->
<A NAME="tex2html1622"
HREF="node66.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html1616"
HREF="node59.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html1610"
HREF="node64.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html1618"
HREF="node14.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<A NAME="tex2html1620"
HREF="node317.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1623"
HREF="node66.html">Function: createCol</A>
<B> Up:</B> <A NAME="tex2html1617"
HREF="node59.html">Arrays</A>
<B> Previous:</B> <A NAME="tex2html1611"
HREF="node64.html">The Language Bindings</A>
<B> <A NAME="tex2html1619"
HREF="node14.html">Contents</A></B>
<B> <A NAME="tex2html1621"
HREF="node317.html">Index</A></B>
<BR>
<BR></DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION02446000000000000000">
The Array API</A>
</H2>
<P>
In the following presentation, we use the SIDL <TT><I CLASS="slanted">double</I></TT> type; however,
everything in this section applies to all types except where noted.
The basic types are in the SIDL
namespace. Table <A HREF="#tbl:basics:arraytypes"
NAME="2666">5.2</A> shows the prefix for SIDL
base types and the actual value type held by the array...
<P>
<BR><P></P>
<DIV ALIGN="CENTER">
<A NAME="tbl:basics:arraytypes"></A>
<DIV ALIGN="CENTER">
<A NAME="2668"></A>
<TABLE CELLPADDING=3 BORDER="1">
<CAPTION><STRONG>Table 5.2:</STRONG>
SIDL types to array function prefixes</CAPTION>
<TR><TH ALIGN="LEFT"><SPAN CLASS="textbf">SIDL TYPE</SPAN></TH>
<TH ALIGN="LEFT"><SPAN CLASS="textbf">ARRAY FUNCTION PREFIX</SPAN></TH>
<TH ALIGN="LEFT"><SPAN CLASS="textbf">VALUE TYPE</SPAN></TH>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">bool</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_bool</TT></TD>
<TD ALIGN="LEFT"><TT>sidl_bool</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">char</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_char</TT></TD>
<TD ALIGN="LEFT"><TT>char</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">dcomplex</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_dcomplex</TT></TD>
<TD ALIGN="LEFT"><TT>struct sidl_dcomplex</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">double</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_double</TT></TD>
<TD ALIGN="LEFT"><TT>double</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">fcomplex</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_fcomplex</TT></TD>
<TD ALIGN="LEFT"><TT>struct sidl_fcomplex</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">float</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_float</TT></TD>
<TD ALIGN="LEFT"><TT>float</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">int</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_int</TT></TD>
<TD ALIGN="LEFT"><TT>int32_t</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">long</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_long</TT></TD>
<TD ALIGN="LEFT"><TT>int64_t</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">opaque</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_opaque</TT></TD>
<TD ALIGN="LEFT"><TT>void *</TT></TD>
</TR>
<TR><TD ALIGN="LEFT"><TT><I CLASS="slanted">string</I></TT></TD>
<TD ALIGN="LEFT"><TT>sidl_string</TT></TD>
<TD ALIGN="LEFT"><TT>char *</TT></TD>
</TR>
</TABLE>
</DIV>
</DIV>
<BR>
<P>
For arrays of interfaces or classes, the name of the
array function prefix is derived from the fully qualified type name.
For example, for the type <TT><I CLASS="slanted">sidl.BaseClass</I></TT>, the
array functions all begin with <TT>sidl_BaseClass</TT>.
For <TT><I CLASS="slanted">sidl.BaseInterface</I></TT>, they all begin with
<TT>sidl_BaseInterface</TT>.
<P>
When you add an object or interface to an array,
the reference count of the element being overwritten is
decremented, and the reference count of the element being added is
incremented. When you get an object or interface from an array,
the caller owns the returned reference.
<P>
For arrays of strings<A NAME="2713"></A> when you add a string to any array, the array
will store a copy of the string. When you retrieve a string from an
array, you will receive a copy of the string. You should
<TT>sidl_String_free</TT> the returned string when you are done with it.
<P>
When you create an array of interfaces, classes, or strings, all
elements of the array are initialized<A NAME="2715"></A> to NULL. Other arrays are not
initialized. When an array of interfaces, classes, or strings is
destroyed, it releases any held references in the case of objects or
interfaces. In the case of strings, it frees any non-NULL pointers.
<P>
The name of the data structure that holds the array if double is
<TT>struct sidl_double__array</TT>. For some types, the data structure
is an opaque type, and for others, it is defined in a public C header
file.
<P>
<BR><P></P>
<DIV ALIGN="CENTER">
<A NAME="tbl:basics:arrayfuncs"></A>
<DIV ALIGN="CENTER">
<A NAME="2718"></A>
<TABLE CELLPADDING=3 BORDER="1">
<CAPTION><STRONG>Table 5.3:</STRONG>
SIDL Array Functions</CAPTION>
<TR><TH ALIGN="LEFT"><SPAN CLASS="textbf">SHORT NAME</SPAN></TH>
<TH ALIGN="LEFT"><SPAN CLASS="textbf">DESCRIPTION</SPAN></TH>
</TR>
<TR><TD ALIGN="LEFT"><TT>createCol</TT></TD>
<TD ALIGN="LEFT">Creates a column-major order SIDL array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>createRow</TT></TD>
<TD ALIGN="LEFT">Creates a row-major order SIDL array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>create1d</TT></TD>
<TD ALIGN="LEFT">Creates a dense one-dimensional SIDL array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>create2dCol</TT></TD>
<TD ALIGN="LEFT">Creates a dense, column-major, two-dimensional SIDL array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>create2dRow</TT></TD>
<TD ALIGN="LEFT">Creates a dense, column-major, two-dimensional SIDL array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>slice</TT></TD>
<TD ALIGN="LEFT">Creates a sub-array of another array. Takes
parameters to define array properties.</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>borrow</TT></TD>
<TD ALIGN="LEFT">Makes a SIDL array from thrid party data
without copying it</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>smartCopy</TT></TD>
<TD ALIGN="LEFT">Copies a borrowed array or addRefs a
non-borrowed array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>addRef</TT></TD>
<TD ALIGN="LEFT">Increments the reference count.</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>deleteRef</TT></TD>
<TD ALIGN="LEFT">Decrements the reference count.</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>get1</TT></TD>
<TD ALIGN="LEFT">Returns the indexed element from a
one-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>get2</TT></TD>
<TD ALIGN="LEFT">Returns the indexed element from a
two-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>get3</TT></TD>
<TD ALIGN="LEFT">Returns the indexed element from a
three-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>get4</TT></TD>
<TD ALIGN="LEFT">Returns the indexed element from a
four-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>get5</TT></TD>
<TD ALIGN="LEFT">Returns the indexed element from a
five-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>get6</TT></TD>
<TD ALIGN="LEFT">Returns the indexed element from a
six-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>get7</TT></TD>
<TD ALIGN="LEFT">Returns the indexed element from a
seven-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>get</TT></TD>
<TD ALIGN="LEFT">Returns the indexed element from
an array of any dimension</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>set1</TT></TD>
<TD ALIGN="LEFT">Sets the indexed element in a
one-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>set2</TT></TD>
<TD ALIGN="LEFT">Sets the indexed element in a
two-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>set3</TT></TD>
<TD ALIGN="LEFT">Sets the indexed element in a
three-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>set4</TT></TD>
<TD ALIGN="LEFT">Sets the indexed element in a
four-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>set5</TT></TD>
<TD ALIGN="LEFT">Sets the indexed element in a
five-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>set6</TT></TD>
<TD ALIGN="LEFT">Sets the indexed element in a
six-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>set7</TT></TD>
<TD ALIGN="LEFT">Sets the indexed element in a
seven-dimensional array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>set</TT></TD>
<TD ALIGN="LEFT">Sets the indexed element in
an array of any dimension</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>dimen</TT></TD>
<TD ALIGN="LEFT">Returns the dimension of the array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>lower</TT></TD>
<TD ALIGN="LEFT">Returns the lower bound of the specified dimension</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>upper</TT></TD>
<TD ALIGN="LEFT">Returns the upper bound of the specified dimension</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>stride</TT></TD>
<TD ALIGN="LEFT">Returns the stride of the specified
dimension</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>length</TT></TD>
<TD ALIGN="LEFT">Returns the length of the Array in the
specified dimension</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>isColumnOrder</TT></TD>
<TD ALIGN="LEFT">Returns true if the array is a dense
column-major order array, false otherwise</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>isRowOrder</TT></TD>
<TD ALIGN="LEFT">Returns true if the array is a dense
row-major order array, false otherwise</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>copy</TT></TD>
<TD ALIGN="LEFT">Copies the contents of source array to dest
array</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>ensure</TT></TD>
<TD ALIGN="LEFT">Returns an array with guaranteed ordering
and dimension from any array.</TD>
</TR>
<TR><TD ALIGN="LEFT"><TT>first</TT></TD>
<TD ALIGN="LEFT">Provides direct access to the element data of
the array.</TD>
</TR>
</TABLE>
</DIV>
</DIV>
<BR>
<P>
The functions are listed succinctly in
Table <A HREF="#tbl:basics:arrayfuncs"
NAME="2765">5.3</A> as well as in detail over the next
few pages.
<P>
<BR><HR>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL CLASS="ChildLinks">
<LI><A NAME="tex2html1624"
HREF="node66.html">Function: createCol</A>
<LI><A NAME="tex2html1625"
HREF="node67.html">Function: createRow</A>
<LI><A NAME="tex2html1626"
HREF="node68.html">Function: create1d</A>
<LI><A NAME="tex2html1627"
HREF="node69.html">Function: create2dCol</A>
<LI><A NAME="tex2html1628"
HREF="node70.html">Function: create2dRow</A>
<LI><A NAME="tex2html1629"
HREF="node71.html">Function: slice</A>
<LI><A NAME="tex2html1630"
HREF="node72.html">Function: borrow</A>
<LI><A NAME="tex2html1631"
HREF="node73.html">Function: smartCopy</A>
<LI><A NAME="tex2html1632"
HREF="node74.html">Function: addRef</A>
<LI><A NAME="tex2html1633"
HREF="node75.html">Function: deleteRef</A>
<LI><A NAME="tex2html1634"
HREF="node76.html">Function: get1</A>
<LI><A NAME="tex2html1635"
HREF="node77.html">Function: get2</A>
<LI><A NAME="tex2html1636"
HREF="node78.html">Function: get3</A>
<LI><A NAME="tex2html1637"
HREF="node79.html">Function: get4</A>
<LI><A NAME="tex2html1638"
HREF="node80.html">Function: get5-7</A>
<LI><A NAME="tex2html1639"
HREF="node81.html">Function: get</A>
<LI><A NAME="tex2html1640"
HREF="node82.html">Function: set1</A>
<LI><A NAME="tex2html1641"
HREF="node83.html">Function: set2</A>
<LI><A NAME="tex2html1642"
HREF="node84.html">Function: set3</A>
<LI><A NAME="tex2html1643"
HREF="node85.html">Function: set4</A>
<LI><A NAME="tex2html1644"
HREF="node86.html">Function: set5-7</A>
<LI><A NAME="tex2html1645"
HREF="node87.html">Function: set</A>
<LI><A NAME="tex2html1646"
HREF="node88.html">Function: dimen</A>
<LI><A NAME="tex2html1647"
HREF="node89.html">Function: lower</A>
<LI><A NAME="tex2html1648"
HREF="node90.html">Function: upper</A>
<LI><A NAME="tex2html1649"
HREF="node91.html">Function: stride</A>
<LI><A NAME="tex2html1650"
HREF="node92.html">Function: length</A>
<LI><A NAME="tex2html1651"
HREF="node93.html">Function: isColumnOrder</A>
<LI><A NAME="tex2html1652"
HREF="node94.html">Function: isRowOrder</A>
<LI><A NAME="tex2html1653"
HREF="node95.html">Function: copy</A>
<LI><A NAME="tex2html1654"
HREF="node96.html">Function: ensure</A>
<LI><A NAME="tex2html1655"
HREF="node97.html">Function: first</A>
</UL>
<!--End of Table of Child-Links-->
<DIV CLASS="navigation"><HR>
<!--Navigation Panel-->
<A NAME="tex2html1622"
HREF="node66.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html1616"
HREF="node59.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html1610"
HREF="node64.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html1618"
HREF="node14.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<A NAME="tex2html1620"
HREF="node317.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1623"
HREF="node66.html">Function: createCol</A>
<B> Up:</B> <A NAME="tex2html1617"
HREF="node59.html">Arrays</A>
<B> Previous:</B> <A NAME="tex2html1611"
HREF="node64.html">The Language Bindings</A>
<B> <A NAME="tex2html1619"
HREF="node14.html">Contents</A></B>
<B> <A NAME="tex2html1621"
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>
|