/*! \mainpage CCfits Documentation
CCfits-2.2 requires cfitsio version 3.08 or later
\htmlonly
Return To CCfits Home Page
\endhtmlonly
\section intro Introduction
CCfits is an object oriented interface to the cfitsio library.
cfitsio is a widely used library for manipulating FITS (Flexible
Image Transport System) formatted files.
This following documentation assumes prior knowledge of the FITS format and
some knowledge of the use of the cfitsio library, which is in wide use,
well developed, and available on many platforms.
\htmlonly
For information about FITS and cfitsio, refer to:
\endhtmlonly
\latexonly
Readers unfamiliar with
FITS but in need of performing I/O with FITS data sets are directed to the first
cfitsio manual, available at
{\it http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html}
Information about the FITS file format and the current standard is available from
{\it http://fits.gsfc.nasa.gov}
\endlatexonly
The CCfits library provides an interface
that allows the user to manipulate FITS format data through the
high-level building blocks of FITS files and Header-Data Units
(HDUs). The implementation is designed to hide the details of
performing FITS I/O from the user, who will write calls that
manipulate FITS objects by passing filenames and lists of strings
that represent HDUs, keywords, image data and data columns. Unlike cfitsio, which typically requires
several calls to access data (e.g. open file, move to correct header, determine
column containing table data, read data) CCfits is designed
to make reading data atomic. For example, it
exploits internally existing optimization techniques for FITS I/O,
choosing the optimal reading strategy as available [see the cfitsio manual, Chapter 13]
when data are read on initialization.
Data written by CCfits will also be compliant with the FITS standard by
specification of class constructors representing FITS dataset elements.
CCfits necessarily works in a fundamentally different way than cfitsio.
The general pattern of usage for CCfits is: create a FITS object, which either opens a disk file
or creates a new disk file, create references to existing or new HDU objects within it,
and manipulated the data through the references. For files with Write access the
library is designed to keep the FITS object on disk in sync with the memory copy.
The additional memory copy increases the resources required by a calling program in
return for some flexibility in accessing the data.
\section about About this Manual
This document lays out the specification for the CCfits library.
\latexonly
The next sections document
the installation procedure and the demonstration program {\it cookbook} which gives
examples of usage with comments.
Following sections give a list of what is implemented in CCfits compared to the cfitsio
library. For background information and as an example there is a section describing how CCfits
is to be used in XSPEC, for which it was originally designed, which may serve to give
the reader some insight into the design decisions made.
\endlatexonly
\htmlonly
The hyperlinks below document the installation procedure, and the demonstration program
cookbook which gives
examples of usage with comments.
\endhtmlonly
\section rel Release Notes For Version 2.2 Sep 2009
Enhancements to CCfits:
- Added an auto-generated pkg-config file to the stand-alone distribution.
- Added an option for case-insensitive searching in the ExtHDU and Table
Column get-by-name functions.
- The public functions column() and numCols() have been added to the
ExtHDU interface. They were previously available only in the derived
Table class.
- New resetRead and getNullValue functions for Column class.
- Improved the documentation for the nullValue versions of the Column
read/write member functions.
Bug Fixes:
- Converted non-standard calls to vector and valarray end iterators.
These were causing runtime exceptions when built with Microsoft Visual C++ v9.0.
- The Column addNullValue function now works for cases where the null value
argument is of a type that requires casting to match the type of data stored
in the Column.
- Fix to the Column writeArrays function for the case where valarrays of
varying length were sent to fixed-width columns. It was previously sending
along a default null value even when the user did not request one.
- Fix for reading and writing complex data types to scalar columns. The
first "firstRow" complex values were not being written or read.
- Renamed private FITS::extension() function to extensionMap(). This is to
prevent user from having to explicitly declare a const FITS pointer in order to
use the public const FITS::extension*() function.
Backwards Compatibility Issue:
- To prevent overloading ambiguity resulting from the new
flag added to ExtHDU/Table get-by-name Column functions for case-insensitive
searches, the protected column(string,Column*) function has been renamed to
setColumn. As this is a protected function, the change should not affect
standard usage of CCfits.
\section rel2 Release Notes For Version 2.1 Nov 2008
- Modified several FITS constructors and FITS::open function to allow
proper handling of CFITSIO extended filename syntax.
- Extended filename syntax example added to cookbook.
- Fix made to FITS::read function for case of missing EXTVER keyword when searching for
HDU with extver > 1.
- Removed inclusion of the internal-only CFITSIO fitsio2.h file from Column.cxx. LONGLONG limits
definitions are now found in fitsio.h.
For a more complete listing, see the CHANGES file distributed with the software.
For earlier versions, see \ref releases.
\section ack Authors and Acknowledgements
CCfits was written as part of a re-engineering effort for the X-Ray data analysis program,
XSPEC. It was designed using Rational Rose and originally implemented on a Solaris platform
by Ben Dorman to whom blame should be attached. Sandhia Bansal
worked on part of the implementation and, and Paul Kunz (pfkeb@slac.stanford.edu) wrote the
configuration scheme and dispensed helpful advice: both are also thanked profusely
for the port to Windows2000/VC++.net. Thanks to R. Mathar (MPIA) and
Patrik Jonsson (Lick Obs.) for contributing many helpful suggestions and bug reports,
and ports to HP-UX and AIX respectively.
CCfits is currently maintained by Craig Gordon and Bryan Irby (ccfits@heasarc.gsfc.nasa.gov). Suggestions and bug reports
are welcome, as are offers to fill out parts of the implementation that are missing. We are
also interested in knowing which parts of cfitsio that are not currently supported should be
the highest priority for future extensions.
*/
/*! \page implementation Implementation Notes
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].
\subsection wrapper CCfits wraps, not replaces, cfitsio.
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.
\subsection ansi ANSI C++ and the Standard C++ Library
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.
- HDUs are contained within a FITS object using a
std::multimap object.
- The map object constructs new array members on first reference
- Objects stored in the map are sorted on entry and retrieved efficiently using binary search techniques.
- The pointer-to-HDU implementation allows for
polymorphism: one set of operations will process all HDU objects within
the FITS file
- String objects (char* ) are represented by the std::string
class, which has a rich public interface of search and manipulation
facilities.
- Scalar column data [one entry per cell] are implemented using std::vector\ objects.
- Vector column data [multiple and either fixed or variable numbers of entries per cell]
are implemented using std::vector\ \>
objects. The std::valarray template is intended for optimized numeric
processing. valarrays are have the following desirable features:
- 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.
- They have built-in
vectorized transcendental functions (e.g. std::valarray\ sin(const std::valarray\& ).
- They provide std::valarray\ apply(T f(const T&)) operation, to apply a function f to each element
- They provide slicing operations [see the "Getting Started" section for a simple example].
- 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.
*/