[1061] | 1 | // ----------------------------------------------------------------------- |
---|
| 2 | // CatalogueSpecification.cc: 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 | #include <duchamp/Outputs/CatalogueSpecification.hh> |
---|
| 30 | #include <duchamp/duchamp.hh> |
---|
| 31 | #include <duchamp/Outputs/columns.hh> |
---|
| 32 | #include <vector> |
---|
| 33 | #include <map> |
---|
| 34 | #include <string> |
---|
| 35 | |
---|
| 36 | namespace duchamp { |
---|
| 37 | |
---|
| 38 | namespace Catalogues { |
---|
| 39 | |
---|
| 40 | CatalogueSpecification::CatalogueSpecification(const CatalogueSpecification& other) |
---|
| 41 | { |
---|
| 42 | operator=(other); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | CatalogueSpecification& CatalogueSpecification::operator= (const CatalogueSpecification& other) |
---|
| 46 | { |
---|
| 47 | if(this == &other) return *this; |
---|
| 48 | this->itsColumnList = other.itsColumnList; |
---|
| 49 | this->itsTypeMap = other.itsTypeMap; |
---|
| 50 | return *this; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | void CatalogueSpecification::addColumn(Column col) |
---|
| 54 | { |
---|
| 55 | if( this->itsTypeMap.find(col.type()) != this->itsTypeMap.end() ) // already in list |
---|
| 56 | this->itsColumnList.erase( this->itsColumnList.begin()+this->itsTypeMap[col.type()] ); |
---|
| 57 | |
---|
| 58 | this->itsColumnList.push_back(col); |
---|
| 59 | this->itsTypeMap[col.type()] = this->itsColumnList.size() - 1; |
---|
| 60 | |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | } |
---|