wcslib (8.2.2)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>WCSLIB: getwcstab.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">WCSLIB<span id="projectnumber"> 8.2.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_af99bb3c152a306abd27951285ad1127.html">C</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Data Structures</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">getwcstab.h File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <fitsio.h></code><br />
</div>
<p><a href="getwcstab_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structwtbarr.html">wtbarr</a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a96c804d78d44901bc5d497b30e47b7ad" id="r_a96c804d78d44901bc5d497b30e47b7ad"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="getwcstab_8h.html#a96c804d78d44901bc5d497b30e47b7ad">fits_read_wcstab</a> (fitsfile *fptr, int nwtb, <a class="el" href="structwtbarr.html">wtbarr</a> *wtb, int *status)</td></tr>
<tr class="memdesc:a96c804d78d44901bc5d497b30e47b7ad"><td class="mdescLeft"> </td><td class="mdescRight">FITS '<code><b>TAB</b></code>' table reading routine. <br /></td></tr>
<tr class="separator:a96c804d78d44901bc5d497b30e47b7ad"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="getwcstab_8h.html#a96c804d78d44901bc5d497b30e47b7ad" 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>
<p><a class="el" href="getwcstab_8h.html#a96c804d78d44901bc5d497b30e47b7ad" 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. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a96c804d78d44901bc5d497b30e47b7ad" name="a96c804d78d44901bc5d497b30e47b7ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a96c804d78d44901bc5d497b30e47b7ad">◆ </a></span>fits_read_wcstab()</h2>
<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>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>FITS '<code><b>TAB</b></code>' table reading routine. </p>
<p><b>fits_read_wcstab</b>() extracts arrays from a binary table required in constructing '<code><b>TAB</b></code>' coordinates.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fptr</td><td>Pointer to the file handle returned, for example, by the fits_open_file() routine in CFITSIO. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">nwtb</td><td>Number of arrays to be read from the binary table(s).</td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">wtb</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#a6dd857f7b61a5b349cc8af5a4b6d8a1c" title="Tabular construction routine.">wcstab()</a> as discussed in the notes below.</td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">status</td><td>CFITSIO status value.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>CFITSIO status value.</dd></dl>
<p><b>Notes:</b> <br />
</p><ol>
<li>
<p class="startli">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>
<p class="interli">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>
<p class="interli">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><div class="fragment"><div class="line">Identifiers fall into several name spaces that <span class="keywordflow">do</span> not interfere with</div>
<div class="line">one another; the same identifier may be used <span class="keywordflow">for</span> different purposes,</div>
<div class="line">even in the same scope, <span class="keywordflow">if</span> the uses are in different name spaces.</div>
<div class="line">These classes are: objects, functions, <span class="keyword">typedef</span> names, and <span class="keyword">enum</span></div>
<div class="line">constants; labels; tags of structures, unions, and enumerations; and</div>
<div class="line">members of each structure or <span class="keyword">union </span>individually.</div>
</div><!-- fragment --><p class="interli">Therefore, declarations within WCSLIB look like </p><div class="fragment"><div class="line"><span class="keyword">struct </span><a class="code hl_struct" href="structwtbarr.html">wtbarr</a> *w;</div>
<div class="ttc" id="astructwtbarr_html"><div class="ttname"><a href="structwtbarr.html">wtbarr</a></div><div class="ttdoc">Extraction of coordinate lookup tables from BINTABLE.</div><div class="ttdef"><b>Definition</b> getwcstab.h:167</div></div>
</div><!-- fragment --><p class="interli">while within CFITSIO they are simply </p><div class="fragment"><div class="line"><a class="code hl_struct" href="structwtbarr.html">wtbarr</a> *w;</div>
</div><!-- fragment --><p class="interli">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 (wtbarr *) is formally required.</p>
<p class="endli">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. </p>
</li>
</ol>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Nov 29 2023 19:09:57 for WCSLIB by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>