Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > ecbd8c5b7568e331fe6ea5b9a07a78a0 > files > 191

CCfits-docs-2.2-2.fc13.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>CCfits: Implementation Notes</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">


<h1><a class="anchor" id="implementation">Implementation Notes </a></h1><p>This section comments on some of the design decisions for CCfits. We note the role of cfitsio in CCfits as the underlying "engine," the use of the C++ standard library. We also explain some of the choices made for standard library containers in the implementation - all of which is hidden from the user [as it should be].</p>
<p>Most importantly, the library wraps rather than replaces the use of cfitsio library; it does not perform direct disk I/O. The scheme is designed to retain the well-developed facilities of cfitsio (in particular, the extended file syntax), and make them available to C++ programmers in an OO framework. Some efficiency is lost over a 'pure' C++ FITS library, since the internal C implementation of many functions requires processing if blocks or switch statements that could be recoded in C++ using templates. However, we believe that the current version strikes a resonable compromise between developer time, utility and efficiency.</p>
<p>The implementation of CCfits uses the C++ Standard Library containers and algorithms [also referred to as the Standard Template Library, (STL)] and exception handling. Here is a summary of the rationale behind the implementation decisions made.</p>
<ul>
<li>
<p class="startli">HDUs are contained within a FITS object using a std::multimap&lt;string, HDU*&gt; object. </p>
<ol>
<li>
The map object constructs new array members on first reference </li>
<li>
Objects stored in the map are sorted on entry and retrieved efficiently using binary search techniques.  </li>
<li>
The pointer-to-HDU implementation allows for polymorphism: one set of operations will process all HDU objects within the FITS file </li>
<li>
String objects (char* ) are represented by the std::string class, which has a rich public interface of search and manipulation facilities. </li>
</ol>
<p class="endli"></p>
</li>
<li>
<p class="startli">Scalar column data [one entry per cell] are implemented using std::vector&lt;T&gt; objects.</p>
<p class="endli"></p>
</li>
<li>
<p class="startli">Vector column data [multiple and either fixed or variable numbers of entries per cell] are implemented using std::vector&lt;std::valarray &lt;T&gt; &gt; objects. The std::valarray template is intended for optimized numeric processing. valarrays are have the following desirable features:</p>
<ol>
<li>
they are dynamic, but designed to be allocated in full on construction rather than dynamic resizing during operation: this is, what is usually needed in FITS files. </li>
<li>
They have built-in vectorized transcendental functions (e.g. <em>std::valarray&lt;T&gt; sin(const std::valarray&lt;T&gt;&amp; )</em>. </li>
<li>
<p class="startli">They provide std::valarray&lt;T&gt; apply(T f(const T&amp;)) operation, to apply a function f to each element</p>
<p class="endli"></p>
</li>
<li>
<p class="startli">They provide slicing operations [see the "Getting Started" section for a simple example].</p>
<p class="endli"></p>
</li>
</ol>
<p></p>
<p class="endli"></p>
</li>
<li>
Exceptions are provided in for by a FitsException hierarchy, which prints out messages on errors and returns control to wherever the exception is caught. Non-zero status values returned by cfitsio are caught by subclass FitsError, which prints the string corresponding to an input status flag. FitsException's other subclasses are thrown on array bounds errors and other programming errors. Rare [we hope] errors that indicate programming flaws in the library throw FitsFatal errors that suggest that the user report the bug. </li>
</ul>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Wed Sep 9 11:59:41 2009 for CCfits by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>