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.

8 Creating and Writing to a Binary Table Extension 19<br />

The interface supports writing to vector tables the following data structures: C-arrays (-<br />

T∗), std::vector objects, std::valarray objects, and std::vector. The last of these is the internal representation of the data.<br />

The function below exercises the following functionality:<br />

• Create a BinTable extension<br />

• Write vector rows to the table<br />

• Insert table rows<br />

• Write complex data to both scalar and vector columns.<br />

• Insert Table columns<br />

• Delete Table rows<br />

• Write HISTORY and COMMENT cards to the Table<br />

int writeBinary ()<br />

{<br />

//*********************************************************************<br />

// Create a BINARY table extension and write and manipulate vector rows<br />

//*********************************************************************<br />

std::auto_ptr pFits(0);<br />

try<br />

{<br />

const std::string fileName("atestfil.fit");<br />

pFits.reset( new FITS(fileName,Write) );<br />

}<br />

catch (<strong>CCfits</strong>::FITS::CantOpen)<br />

{<br />

return -1;<br />

}<br />

unsigned long rows(3);<br />

string hduName("TABLE_BINARY");<br />

std::vector colName(7,"");<br />

std::vector colForm(7,"");<br />

std::vector colUnit(7,"");<br />

colName[0] = "numbers";<br />

colName[1] = "sequences";<br />

colName[2] = "powers";<br />

colName[3] = "big-integers";<br />

colName[4] = "dcomplex-roots";<br />

colName[5] = "fcomplex-roots";<br />

colName[6] = "scalar-complex";<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!