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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>WCSLIB 4.8.2: getwcstab.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>getwcstab.h File Reference</h1><code>#include <fitsio.h></code><br>
<p>
<a href="getwcstab_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structwtbarr.html">wtbarr</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Extraction of coordinate lookup tables from BINTABLE. <a href="structwtbarr.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="getwcstab_8h.html#96c804d78d44901bc5d497b30e47b7ad">fits_read_wcstab</a> (fitsfile *fptr, int nwtb, <a class="el" href="structwtbarr.html">wtbarr</a> *wtb, int *status)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">FITS '<code><b>TAB</b></code>' table reading routine. <a href="#96c804d78d44901bc5d497b30e47b7ad"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="getwcstab_8h.html#96c804d78d44901bc5d497b30e47b7ad" title="FITS 'TAB' table reading routine.">fits_read_wcstab()</a>, an implementation of a FITS table reading routine for '<code><b>TAB</b></code>' coordinates, is provided for CFITSIO programmers. It has been incorporated into CFITSIO as of v3.006 with the definitions in this file, <a class="el" href="getwcstab_8h.html">getwcstab.h</a>, moved into fitsio.h.<p>
<a class="el" href="getwcstab_8h.html#96c804d78d44901bc5d497b30e47b7ad" title="FITS 'TAB' table reading routine.">fits_read_wcstab()</a> is not included in the WCSLIB object library but the source code is presented here as it may be useful for programmers using an older version of CFITSIO than 3.006, or as a programming template for non-CFITSIO programmers. <hr><h2>Function Documentation</h2>
<a class="anchor" name="96c804d78d44901bc5d497b30e47b7ad"></a><!-- doxytag: member="getwcstab.h::fits_read_wcstab" ref="96c804d78d44901bc5d497b30e47b7ad" args="(fitsfile *fptr, int nwtb, wtbarr *wtb, int *status)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int fits_read_wcstab </td>
<td>(</td>
<td class="paramtype">fitsfile * </td>
<td class="paramname"> <em>fptr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>nwtb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structwtbarr.html">wtbarr</a> * </td>
<td class="paramname"> <em>wtb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>status</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<b>fits_read_wcstab</b>() extracts arrays from a binary table required in constructing '<code><b>TAB</b></code>' coordinates.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>fptr</em> </td><td>Pointer to the file handle returned, for example, by the fits_open_file() routine in CFITSIO. </td></tr>
<tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>nwtb</em> </td><td>Number of arrays to be read from the binary table(s).</td></tr>
<tr><td valign="top"><tt>[in,out]</tt> </td><td valign="top"><em>wtb</em> </td><td>Address of the first element of an array of <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> typedefs. This <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> typedef is defined to match the <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> struct defined in WCSLIB. An array of such structs returned by the WCSLIB function <a class="el" href="wcshdr_8h.html#6dd857f7b61a5b349cc8af5a4b6d8a1c" title="Tabular construction routine.">wcstab()</a> as discussed in the notes below.</td></tr>
<tr><td valign="top"><tt>[out]</tt> </td><td valign="top"><em>status</em> </td><td>CFITSIO status value.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>CFITSIO status value.</dd></dl>
<b>Notes:</b> <br>
In order to maintain WCSLIB and CFITSIO as independent libraries it is not permissible for any CFITSIO library code to include WCSLIB header files, or vice versa. However, the CFITSIO function <b>fits_read_wcstab</b>() accepts an array of <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> structs defined in <a class="el" href="wcs_8h.html">wcs.h</a> within WCSLIB.<p>
The problem therefore is to define the <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> struct within fitsio.h without including <a class="el" href="wcs_8h.html">wcs.h</a>, especially noting that <a class="el" href="wcs_8h.html">wcs.h</a> will often (but not always) be included together with fitsio.h in an applications program that uses <b>fits_read_wcstab</b>().<p>
The solution adopted is for WCSLIB to define "struct <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a>" while fitsio.h defines "typedef <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a>" as an untagged struct with identical members. This allows both <a class="el" href="wcs_8h.html">wcs.h</a> and fitsio.h to define a <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> data type without conflict by virtue of the fact that structure tags and typedef names share different name spaces in C; Appendix A, Sect. A11.1 (p227) of the K&R ANSI edition states that:<p>
Identifiers fall into several name spaces that do not interfere with one another; the same identifier may be used for different purposes, even in the same scope, if the uses are in different name spaces. These classes are: objects, functions, typedef names, and enum constants; labels; tags of structures, unions, and enumerations; and members of each structure or union individually.<p>
Therefore, declarations within WCSLIB look like <div class="fragment"><pre class="fragment"> <span class="keyword">struct </span><a class="code" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> *w;
</pre></div><p>
while within CFITSIO they are simply <div class="fragment"><pre class="fragment"> <a class="code" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> *w;
</pre></div><p>
As suggested by the commonality of the names, these are really the same aggregate data type. However, in passing a (struct <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> *) to <b>fits_read_wcstab</b>() a cast to (<a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> *) is formally required.<p>
When using WCSLIB and CFITSIO together in C++ the situation is complicated by the fact that typedefs and structs share the same namespace; C++ Annotated Reference Manual, Sect. 7.1.3 (p105). In that case the <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> struct in <a class="el" href="wcs_8h.html">wcs.h</a> is renamed by preprocessor macro substitution to wtbarr_s to distinguish it from the typedef defined in fitsio.h. However, the scope of this macro substitution is limited to <a class="el" href="wcs_8h.html">wcs.h</a> itself and CFITSIO programmer code, whether in C++ or C, should always use the <a class="el" href="structwtbarr.html" title="Extraction of coordinate lookup tables from BINTABLE.">wtbarr</a> typedef.
</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Oct 4 19:02:30 2011 for WCSLIB 4.8.2 by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
|