[1061] | 1 | // ----------------------------------------------------------------------- |
---|
| 2 | // CatalogueSpecification.hh: Define the specification of a catalogue, |
---|
| 3 | // being a set of Columns |
---|
| 4 | // ----------------------------------------------------------------------- |
---|
| 5 | // Copyright (C) 2006, Matthew Whiting, ATNF |
---|
| 6 | // |
---|
| 7 | // This program is free software; you can redistribute it and/or modify it |
---|
| 8 | // under the terms of the GNU General Public License as published by the |
---|
| 9 | // Free Software Foundation; either version 2 of the License, or (at your |
---|
| 10 | // option) any later version. |
---|
| 11 | // |
---|
| 12 | // Duchamp is distributed in the hope that it will be useful, but WITHOUT |
---|
| 13 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
| 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
| 15 | // for more details. |
---|
| 16 | // |
---|
| 17 | // You should have received a copy of the GNU General Public License |
---|
| 18 | // along with Duchamp; if not, write to the Free Software Foundation, |
---|
| 19 | // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
---|
| 20 | // |
---|
| 21 | // Correspondence concerning Duchamp may be directed to: |
---|
| 22 | // Internet email: Matthew.Whiting [at] atnf.csiro.au |
---|
| 23 | // Postal address: Dr. Matthew Whiting |
---|
| 24 | // Australia Telescope National Facility, CSIRO |
---|
| 25 | // PO Box 76 |
---|
| 26 | // Epping NSW 1710 |
---|
| 27 | // AUSTRALIA |
---|
| 28 | // ----------------------------------------------------------------------- |
---|
| 29 | #ifndef DUCHAMP_CATALOGUE_SPEC_H |
---|
| 30 | #define DUCHAMP_CATALOGUE_SPEC_H |
---|
| 31 | |
---|
| 32 | #include <duchamp/duchamp.hh> |
---|
| 33 | #include <duchamp/Outputs/columns.hh> |
---|
| 34 | #include <vector> |
---|
| 35 | #include <map> |
---|
| 36 | |
---|
| 37 | namespace duchamp { |
---|
| 38 | |
---|
[1422] | 39 | class Detection; |
---|
| 40 | class FitsHeader; |
---|
| 41 | |
---|
[1061] | 42 | namespace Catalogues { |
---|
| 43 | |
---|
| 44 | class CatalogueSpecification |
---|
| 45 | { |
---|
| 46 | public: |
---|
| 47 | CatalogueSpecification(){}; |
---|
| 48 | CatalogueSpecification(const CatalogueSpecification& other); |
---|
| 49 | CatalogueSpecification& operator= (const CatalogueSpecification& other); |
---|
| 50 | virtual ~CatalogueSpecification(){}; |
---|
| 51 | |
---|
| 52 | void addColumn(Column col); |
---|
[1422] | 53 | void addColumn(std::string type, std::string name, std::string units, int width, int prec, std::string ucd="", std::string datatype="", std::string colID="", std::string extraInfo=""); |
---|
[1064] | 54 | Column &column(std::string type){return itsColumnList[itsTypeMap[type]];}; |
---|
| 55 | Column &column(int i){return itsColumnList[i];}; |
---|
| 56 | Column *pCol(int i){return &(itsColumnList[i]);}; |
---|
| 57 | void removeColumn(std::string type); |
---|
[1152] | 58 | bool hasColumn(std::string type); |
---|
[1153] | 59 | void setMap(); |
---|
[1061] | 60 | size_t size(){return itsColumnList.size();}; |
---|
| 61 | |
---|
[1137] | 62 | void outputTableHeader(std::ostream &stream, Catalogues::DESTINATION tableType, bool flagWCS); |
---|
[1061] | 63 | |
---|
[1137] | 64 | /// @brief Set the comment characters |
---|
| 65 | void setCommentString(std::string comment){itsCommentString = comment;}; |
---|
| 66 | std::string commentString(){return itsCommentString;}; |
---|
| 67 | |
---|
[1422] | 68 | /// If the named column exists in the specification, check its width using the value |
---|
| 69 | template <class T> void check(std::string type, T value); |
---|
| 70 | /// If the named column exists in the specification, check its width and precision using the value |
---|
| 71 | template <class T> void check(std::string type, T value, bool doPrec); |
---|
| 72 | |
---|
| 73 | void checkAll(std::vector<Detection> &objectList, FitsHeader &head); |
---|
| 74 | |
---|
[1061] | 75 | protected: |
---|
| 76 | std::vector<Column> itsColumnList; |
---|
| 77 | std::map<std::string, int> itsTypeMap; |
---|
[1137] | 78 | std::string itsCommentString; ///< Any comment characters etc that need to be prepended to the table header |
---|
| 79 | |
---|
[1061] | 80 | }; |
---|
| 81 | |
---|
| 82 | |
---|
[1064] | 83 | /// @brief Returns a vector of Col for results file output. |
---|
| 84 | CatalogueSpecification getFullColSet(std::vector<Detection> &objectList, FitsHeader &head); |
---|
| 85 | |
---|
| 86 | /// @brief Returns a vector of Col for logfile output. |
---|
| 87 | CatalogueSpecification getLogColSet(std::vector<Detection> &objectList, FitsHeader &head); |
---|
| 88 | |
---|
[1061] | 89 | } |
---|
| 90 | |
---|
| 91 | } |
---|
| 92 | #endif |
---|