source: trunk/src/SDContainer.cc@ 893

Last change on this file since 893 was 838, checked in by mar637, 19 years ago

added conformant() which checks if to objects are conformant

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
RevLine 
[2]1//#---------------------------------------------------------------------------
2//# SDContainer.cc: A container class for single dish integrations
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2004
[125]5//# ATNF
[2]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 Free
9//# Software Foundation; either version 2 of the License, or (at your option)
10//# any later version.
11//#
12//# This program is distributed in the hope that it will be useful, but
13//# WITHOUT ANY WARRANTY; without even the implied warranty of
14//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15//# Public License for more details.
16//#
17//# You should have received a copy of the GNU General Public License along
18//# with this program; if not, write to the Free Software Foundation, Inc.,
19//# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20//#
21//# Correspondence concerning this software should be addressed as follows:
22//# Internet email: Malte.Marquarding@csiro.au
23//# Postal address: Malte Marquarding,
24//# Australia Telescope National Facility,
25//# P.O. Box 76,
26//# Epping, NSW, 2121,
27//# AUSTRALIA
28//#
29//# $Id:
30//#---------------------------------------------------------------------------
[349]31
[125]32#include <casa/aips.h>
[327]33#include <casa/iostream.h>
34#include <casa/iomanip.h>
[104]35#include <casa/Exceptions.h>
[349]36#include <casa/Utilities/Assert.h>
[81]37#include <casa/Arrays/IPosition.h>
38#include <casa/Quanta/MVTime.h>
[2]39
[308]40
[349]41
[832]42#include "STDefs.h"
[2]43#include "SDContainer.h"
44
[125]45using namespace casa;
[83]46using namespace asap;
[2]47
[838]48
49
50bool SDHeader::conformant( const SDHeader& other )
51{
52 bool conforms;
53 conforms = (this->antennaname == other.antennaname
54 && this->equinox == other.equinox
55 && this->obstype == other.obstype
56 && this->fluxunit == other.fluxunit
57 );
58 return conforms;
59}
60
[18]61void SDHeader::print() const {
62 MVTime mvt(this->utc);
[47]63 mvt.setFormat(MVTime::YMD);
[832]64 cout << "Observer: " << this->observer << endl
[18]65 << "Project: " << this->project << endl
66 << "Obstype: " << this->obstype << endl
67 << "Antenna: " << this->antennaname << endl
68 << "Ant. Position: " << this->antennaposition << endl
69 << "Equinox: " << this->equinox << endl
70 << "Freq. ref.: " << this->freqref << endl
71 << "Ref. frequency: " << this->reffreq << endl
72 << "Bandwidth: " << this->bandwidth << endl
[832]73 << "Time (utc): "
[47]74 << mvt
[18]75 << endl;
76 //setprecision(10) << this->utc << endl;
77}
78
[349]79// SDDataDesc
80
[832]81uInt SDDataDesc::addEntry(const String& source, uInt ID,
[453]82 const MDirection& dir, uInt secID)
[326]83{
84
85// See if already exists
86
87 if (n_ > 0) {
88 for (uInt i=0; i<n_; i++) {
[396]89 if (source==source_[i] && ID==ID_[i]) {
[326]90 return i;
91 }
92 }
93 }
94
95// Not found - add it
96
97 n_ += 1;
98 source_.resize(n_,True);
[396]99 ID_.resize(n_,True);
100 secID_.resize(n_,True);
101 secDir_.resize(n_,True,True);
[326]102//
103 source_[n_-1] = source;
[396]104 ID_[n_-1] = ID;
105 secID_[n_-1] = secID;
106 secDir_[n_-1] = dir;
[326]107//
108 return n_-1;
109}
110
111void SDDataDesc::summary() const
112{
[396]113 if (n_>0) {
[832]114 cerr << "Source ID" << endl;
[396]115 for (uInt i=0; i<n_; i++) {
[414]116 cout << setw(11) << source_(i) << ID_(i) << endl;
[396]117 }
[326]118 }
119}
[453]120
Note: See TracBrowser for help on using the repository browser.