// Useful functions - mostly using CCfits #ifndef HAVE_HEASP #include "heasp.h" #endif #define HAVE_SPio 1 // Read a keyword from the primary header. template T SPreadKey(PHDU&, string, T); // Read a keyword from an extension. template T SPreadKey(ExtHDU&, string, T); // Read a keyword from a type II file. Note for type I files RowNumber will necessarily be 1. template T SPreadKey(ExtHDU&, string, Integer, T); // Read a column into a valarray/vector template void SPreadCol(ExtHDU&, string, valarray&); template void SPreadCol(ExtHDU&, string, vector&); // Need special case for strings because of the workaround required for a // missing routine in CCfits void SPreadCol(ExtHDU&, string, vector&); // Read a column from a type II file into a valarray/vector // for type I data the RowNumber is necessarily 1. template void SPreadCol(ExtHDU&, string, Integer, valarray&); template void SPreadCol(ExtHDU&, string, Integer, vector&); // Read a vector column into a vector of valarray/vector template void SPreadVectorCol(ExtHDU&, string, vector >&); template void SPreadVectorCol(ExtHDU&, string, vector >&); // Read a single row of vector column into a valarray/vector template void SPreadVectorColRow(ExtHDU&, string, Integer, valarray&); template void SPreadVectorColRow(ExtHDU&, string, Integer, vector&); // Write a keyword - at present just a wrap-up of addKey template void SPwriteKey(Table&, string, T, string); // Write a column from a valarray/vector. If the data size is 1 or all // values are the same then just write a keyword template void SPwriteCol(Table&, string, valarray&); template void SPwriteCol(Table&, string, vector&); // Write a column from a valarray/vector. If the data size is 1 or all // values are the same then just write a keyword if the forceCol bool is false. template void SPwriteCol(Table&, string, valarray&, bool); template void SPwriteCol(Table&, string, vector&, bool); // Write a column from a valarray/vector. If the data size is 1 or all values are the // same then just write a keyword template void SPwriteCol(Table&, string, valarray&); template void SPwriteCol(Table&, string, vector&); // Write a column from a vector of valarrays/vectors. If the data size is 1 or // all values are the same then just write a keyword. If all values are the same // within all valarrays then write a scalar column template void SPwriteVectorCol(Table&, string, vector >&); template void SPwriteVectorCol(Table&, string, vector >&); // Write a column for a vector of valarrays/vectors. If the data size is 1 or all // values are the same then just write a keyword if the forceCol bool is false. // If all values are the same within all valarrays then write a scalar column template void SPwriteVectorCol(Table&, string, vector >&, bool); template void SPwriteVectorCol(Table&, string, vector >&, bool); // check whether a given column is required and if it needs to be a vector column // note that T is assumed to be a valarray or vector of a valarray of some type. template bool SPneedCol(const T&); // check whether a given column is required. For this overloaded version // T is assumed to be a valarray or a vector of a scalar of some type. template bool SPneedCol(const T&, bool& isvector);