#ifndef COLUMNS_H #define COLUMNS_H #include #include #include #include using std::string; using std::vector; class Detection; class FitsHeader; namespace Column { // First, define some basic quantities. // The default values for the columns, and default values for // the precision of different types of columns. const int numColumns=23; const int numColumnsLog=14; const int numPrec=6; enum PrecType {prFLUX, prVEL, prXYZ, prPOS, prWPOS, prSNR}; const int prec[numPrec]={3, 3, 1, 6, 2, 2}; enum COLNAME {NUM=0, NAME, X, Y, Z, RA, DEC, VEL, WRA, WDEC, WVEL, FINT, FTOT, FPEAK, SNRPEAK, X1, X2, Y1, Y2, Z1, Z2, NPIX, FLAG}; enum LOGNAME {lNUM, lX, lY, lZ, lFTOT, lFPEAK, lSNRPEAK, lX1, lX2, lY1, lY2, lZ1, lZ2, lNPIX}; const int defaultWidth[numColumns]= {5, 8, 6, 6, 6, 13, 13, 7, 9, 9, 7, 10, 10, 9, 7, 4, 4, 4, 4, 4, 4, 6, 5}; const int defaultPrec[numColumns]= {0, 0, prec[prXYZ], prec[prXYZ], prec[prXYZ], 0, 0, prec[prVEL], prec[prWPOS], prec[prWPOS], prec[prVEL], prec[prFLUX], prec[prFLUX], prec[prFLUX], prec[prSNR], 0, 0, 0, 0, 0, 0, 0, 0}; const string defaultName[numColumns]= {"Obj#","Name","X","Y","Z", "RA","DEC","VEL", "w_RA","w_DEC","w_VEL", "F_int","F_tot","F_peak", "S/Nmax", "X1","X2","Y1","Y2","Z1","Z2","Npix","Flag"}; const string defaultUnits[numColumns]= {"","","","","", "","","", "[arcmin]","[arcmin]","", "","","", "", "","","","","","","[pix]",""}; // Now define the Col class. // This contains information about a given column -- its width, the // precision associated with it, its title and the units. // Plus the usual array of accessor functions and so on. class Col{ public: Col(){width=1; precision=0; name=" "; units=" ";}; Col(int num); // in columns.cc virtual ~Col(){}; // basic accessor functions int getWidth(){return width;}; void setWidth(int i){width=i;}; int getPrecision(){return precision;}; void setPrecision(int i){precision=i;}; string getName(){return name;}; void setName(string s){name=s;}; string getUnits(){return units;}; void setUnits(string s){units=s;}; // other functions int widen(){width++;}; int upPrec(){precision++; if(widthwidth) << std::setfill(' ') << this->name; }; void printUnits(std::ostream &stream){ stream << std::setw(this->width) << std::setfill(' ') << this->units; }; void printDash (std::ostream &stream){ stream << std::setw(this->width) << std::setfill('-') << "" << std::setfill(' '); }; void printBlank(std::ostream &stream){ stream << std::setw(this->width) << std::setfill(' ') << ""; }; template void printEntry(std::ostream &stream, T value) { stream << std::setprecision(this->precision) << std::setw(this->width) << std::setfill(' ') << value; } private: int width; // how wide is the column (in ascii spaces) int precision; // what precision should be used to print the values? // if 0, the setprecision command is not used. string name; // the title of the column string units; // what units the values in the column are expressed in }; } vector getFullColSet(vector &objectList, FitsHeader &head); vector getLogColSet(vector &objectList, FitsHeader &head); #endif