source: trunk/src/Outputs/CatalogueSpecification.cc @ 1061

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

Ticket #162 - A large refactoring of the Column-related code. Columns have moved to Outputs, and in a new namespace Catalogues. The interface has changed, using strings to record the type rather
than the enum. Also included is a new class CatalogueSpecification?, that is designed to hold a collection of Columns. This is not yet implemented - everything still uses the full & log column
vectors, and the code still passes the verification script.

File size: 2.3 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 <vector>
33#include <map>
34#include <string>
35
36namespace 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}
Note: See TracBrowser for help on using the repository browser.