source: tags/release-1.2.2/src/Outputs/CatalogueSpecification.cc

Last change on this file was 1064, checked in by MatthewWhiting, 12 years ago

Continuing Ticket #162 -- moving to the use of CatalogueSpecification?. Also fixing a bug where the VOTable column ID string was not being set (identified via the verification script!).

File size: 2.5 KB
Line 
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 <duchamp/Outputs/CatalogueSpecification.hh>
33#include <vector>
34#include <map>
35#include <string>
36
37namespace duchamp {
38
39  namespace Catalogues {
40
41    CatalogueSpecification::CatalogueSpecification(const CatalogueSpecification& other)
42    {
43      operator=(other);
44    }
45
46    CatalogueSpecification& CatalogueSpecification::operator= (const CatalogueSpecification& other)
47    {
48      if(this == &other) return *this;
49      this->itsColumnList = other.itsColumnList;
50      this->itsTypeMap = other.itsTypeMap;
51      return *this;
52    }
53
54    void CatalogueSpecification::addColumn(Column col)
55    {
56      this->removeColumn(col.type());
57      this->itsColumnList.push_back(col);
58      this->itsTypeMap[col.type()] = this->itsColumnList.size() - 1;
59
60    }
61
62    void CatalogueSpecification::removeColumn(std::string type)
63    {
64      if( this->itsTypeMap.find(type) != this->itsTypeMap.end() ) // already in list
65        this->itsColumnList.erase( this->itsColumnList.begin()+this->itsTypeMap[type] );
66
67    }
68
69  }
70
71}
Note: See TracBrowser for help on using the repository browser.