CCfits - HEASARC - NASA
CCfits - HEASARC - NASA CCfits - HEASARC - NASA
8 Creating and Writing to a Binary Table Extension 19 The interface supports writing to vector tables the following data structures: C-arrays (- T∗), std::vector objects, std::valarray objects, and std::vector. The last of these is the internal representation of the data. The function below exercises the following functionality: • Create a BinTable extension • Write vector rows to the table • Insert table rows • Write complex data to both scalar and vector columns. • Insert Table columns • Delete Table rows • Write HISTORY and COMMENT cards to the Table int writeBinary () { //********************************************************************* // Create a BINARY table extension and write and manipulate vector rows //********************************************************************* std::auto_ptr pFits(0); try { const std::string fileName("atestfil.fit"); pFits.reset( new FITS(fileName,Write) ); } catch (CCfits::FITS::CantOpen) { return -1; } unsigned long rows(3); string hduName("TABLE_BINARY"); std::vector colName(7,""); std::vector colForm(7,""); std::vector colUnit(7,""); colName[0] = "numbers"; colName[1] = "sequences"; colName[2] = "powers"; colName[3] = "big-integers"; colName[4] = "dcomplex-roots"; colName[5] = "fcomplex-roots"; colName[6] = "scalar-complex"; Generated on Tue Dec 6 2011 16:12:51 for CCfits by Doxygen
8 Creating and Writing to a Binary Table Extension 20 colForm[0] = "8A"; colForm[1] = "20J"; colForm[2] = "20D"; colForm[3] = "20V"; colForm[4] = "20M"; colForm[5] = "20C"; colForm[6] = "1M"; colUnit[0] = "magnets"; colUnit[1] = "bulbs"; colUnit[2] = "batteries"; colUnit[3] = "mulberries"; colUnit[4] = ""; colUnit[5] = ""; colUnit[6] = "pico boo"; std::vector numbers(rows); const string num("NUMBER-"); for (size_t j = 0; j < rows; ++j) { #ifdef HAVE_STRSTREAM std::ostrstream pStr; #else std::ostringstream pStr; #endif pStr
- Page 1 and 2: CCfits 2.4 Generated by Doxygen 1.7
- Page 3 and 4: CONTENTS ii 16 Previous Release Not
- Page 5 and 6: CONTENTS iv 24.20.3 Member Function
- Page 7 and 8: 1.2 About this Manual 2 manipulated
- Page 9 and 10: 1.5 Release Notes For Version 2.2 S
- Page 11 and 12: 2.2 Building 6 2.2.1 Instructions f
- Page 13 and 14: 3 Implementation Notes 8 3 Implemen
- Page 15 and 16: 4.3 Modularity 10 4.3 Modularity Th
- Page 17 and 18: 6 Writing Primary Images and Image
- Page 19 and 20: 6 Writing Primary Images and Image
- Page 21 and 22: 7 Creating and Writing to an Ascii
- Page 23: 8 Creating and Writing to a Binary
- Page 27 and 28: 8 Creating and Writing to a Binary
- Page 29 and 30: 10 Selecting Table Data 24 const st
- Page 31 and 32: 12 Reading an Image 26 // read a pa
- Page 33 and 34: 14 Reading with Extended File Name
- Page 35 and 36: 15.1 What’s Not Present 30 15.1 W
- Page 37 and 38: 16 Previous Release Notes 32 • Fi
- Page 39 and 40: 20 Hierarchical Index 34 20 Hierarc
- Page 41 and 42: 21.1 Class List 36 CCfits::AsciiTab
- Page 43 and 44: 21.1 Class List 38 CCfits::FITSUtil
- Page 45 and 46: 23 Namespace Documentation 40 23 Na
- Page 47 and 48: 23.2 FITSUtil Namespace Reference 4
- Page 49 and 50: 24.1 CCfits::AsciiTable Class Refer
- Page 51 and 52: 24.2 CCfits::BinTable Class Referen
- Page 53 and 54: 24.2 CCfits::BinTable Class Referen
- Page 55 and 56: 24.3 CCfits::Column Class Reference
- Page 57 and 58: 24.3 CCfits::Column Class Reference
- Page 59 and 60: 24.3 CCfits::Column Class Reference
- Page 61 and 62: 24.3 CCfits::Column Class Reference
- Page 63 and 64: 24.3 CCfits::Column Class Reference
- Page 65 and 66: 24.3 CCfits::Column Class Reference
- Page 67 and 68: 24.3 CCfits::Column Class Reference
- Page 69 and 70: 24.5 CCfits::Column::InvalidDataTyp
- Page 71 and 72: 24.7 CCfits::Column::InvalidRowNumb
- Page 73 and 74: 24.9 CCfits::Column::NoNullValue Cl
8 Creating and Writing to a Binary Table Extension 20<br />
colForm[0] = "8A";<br />
colForm[1] = "20J";<br />
colForm[2] = "20D";<br />
colForm[3] = "20V";<br />
colForm[4] = "20M";<br />
colForm[5] = "20C";<br />
colForm[6] = "1M";<br />
colUnit[0] = "magnets";<br />
colUnit[1] = "bulbs";<br />
colUnit[2] = "batteries";<br />
colUnit[3] = "mulberries";<br />
colUnit[4] = "";<br />
colUnit[5] = "";<br />
colUnit[6] = "pico boo";<br />
std::vector numbers(rows);<br />
const string num("NUMBER-");<br />
for (size_t j = 0; j < rows; ++j)<br />
{<br />
#ifdef HAVE_STRSTREAM<br />
std::ostrstream pStr;<br />
#else<br />
std::ostringstream pStr;<br />
#endif<br />
pStr