27.01.2015 Views

CCfits - HEASARC - NASA

CCfits - HEASARC - NASA

CCfits - HEASARC - NASA

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.3 Modularity 10<br />

4.3 Modularity<br />

Third, in an object oriented design, it is possible to make a program only loosely dependent<br />

on current implementation assumptions. In XSPEC, data are read as SF and<br />

FITS format (of three different varieties) and the user interface is written in tcl/tk. Both<br />

of these assumptions could be changed over the future life of the program. Thus the<br />

design of XSPEC, and any similar program, consists of defining an abstract DataSet<br />

class which has a subclass that uses FITS data. The virtual functions that support reading<br />

and writing can easily be overloaded by alternatives to FITS. Thus, the class library<br />

specified here fits in with the need for modularity in design.<br />

5 Getting Started<br />

The program cookbook.cxx, analogous to the cookbook.c program supplied with cfitsio,<br />

was generated to test the correct functioning of the parts of the library and to<br />

provide a demonstration of its usage.<br />

The code for cookbook is reproduced here with commentary as worked example of the<br />

usage of the library.<br />

5.1 Driver Program<br />

// The <strong>CCfits</strong> headers are expected to be installed in a subdirectory of<br />

// the include path.<br />

// The header file contains all that is necessary to use both the<br />

<strong>CCfits</strong><br />

// library and the cfitsio library (for example, it includes fitsio.h) thus<br />

making<br />

// all of cfitsio’s macro definitions available.<br />

#ifdef HAVE_CONFIG_H<br />

#include "config.h"<br />

#endif<br />

// this includes 12 of the <strong>CCfits</strong> headers and will support all <strong>CCfits</strong><br />

operations.<br />

// the installed location of the library headers is $(ROOT)/include/<strong>CCfits</strong><br />

// to use the library either add -I$(ROOT)/include/<strong>CCfits</strong> or #include<br />

<br />

// in the compilation target.<br />

#include <br />

#include <br />

// The library is enclosed in a namespace.<br />

using namespace <strong>CCfits</strong>;<br />

Generated on Tue Dec 6 2011 16:12:51 for <strong>CCfits</strong> by Doxygen

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!