1 | // ----------------------------------------------------------------------- |
---|
2 | // CatalogueWriter.cc: Implementation of the base class for writing |
---|
3 | // results to output files |
---|
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 | |
---|
30 | #include <duchamp/Outputs/CatalogueWriter.hh> |
---|
31 | #include <duchamp/param.hh> |
---|
32 | #include <duchamp/fitsHeader.hh> |
---|
33 | #include <duchamp/Detection/detection.hh> |
---|
34 | #include <duchamp/Outputs/columns.hh> |
---|
35 | #include <duchamp/Utils/Statistics.hh> |
---|
36 | #include <duchamp/Cubes/cubes.hh> |
---|
37 | |
---|
38 | namespace duchamp { |
---|
39 | |
---|
40 | CatalogueWriter::CatalogueWriter() |
---|
41 | { |
---|
42 | itsName=""; |
---|
43 | itsOpenFlag=false; |
---|
44 | this->itsParam=0; |
---|
45 | this->itsStats=0; |
---|
46 | this->itsHead=0; |
---|
47 | this->itsObjectList=0; |
---|
48 | this->itsCubeDim=0; |
---|
49 | } |
---|
50 | |
---|
51 | CatalogueWriter::CatalogueWriter(std::string name): |
---|
52 | itsName(name) |
---|
53 | { |
---|
54 | itsOpenFlag=false; |
---|
55 | this->itsParam=0; |
---|
56 | this->itsStats=0; |
---|
57 | this->itsHead=0; |
---|
58 | this->itsObjectList=0; |
---|
59 | this->itsCubeDim=0; |
---|
60 | } |
---|
61 | |
---|
62 | CatalogueWriter::CatalogueWriter(const CatalogueWriter& other) |
---|
63 | { |
---|
64 | this->operator=(other); |
---|
65 | } |
---|
66 | |
---|
67 | CatalogueWriter& CatalogueWriter::operator= (const CatalogueWriter& other) |
---|
68 | { |
---|
69 | if(this == &other) return *this; |
---|
70 | this->itsName = other.itsName; |
---|
71 | this->itsOpenFlag = other.itsOpenFlag; |
---|
72 | this->itsColumnSpecification = other.itsColumnSpecification; |
---|
73 | this->itsParam=other.itsParam; |
---|
74 | this->itsStats=other.itsStats; |
---|
75 | this->itsHead=other.itsHead; |
---|
76 | this->itsObjectList=other.itsObjectList; |
---|
77 | this->itsCubeDim=other.itsCubeDim; |
---|
78 | return *this; |
---|
79 | } |
---|
80 | |
---|
81 | void CatalogueWriter::setup(Cube *cube) |
---|
82 | { |
---|
83 | /// @details Defines the various pointer members to point to the |
---|
84 | /// relevant information from the cube in question. |
---|
85 | this->itsParam = &(cube->pars()); |
---|
86 | this->itsStats = &(cube->stats()); |
---|
87 | this->itsHead = &(cube->header()); |
---|
88 | this->itsObjectList = cube->pObjectList(); |
---|
89 | this->itsColumnSpecification = cube->pFullCols(); |
---|
90 | this->itsCubeDim = cube->getDimArray(); |
---|
91 | } |
---|
92 | |
---|
93 | void CatalogueWriter::writeEntries() |
---|
94 | { |
---|
95 | if(this->itsOpenFlag){ |
---|
96 | for(std::vector<Detection>::iterator obj=this->itsObjectList->begin();obj<this->itsObjectList->end();obj++) |
---|
97 | this->writeEntry(&*obj); |
---|
98 | } |
---|
99 | } |
---|
100 | |
---|
101 | |
---|
102 | } |
---|