| 1 | //#---------------------------------------------------------------------------
|
|---|
| 2 | //# SDReader.h: A class to read single dish spectra from SDFITS, RPFITS
|
|---|
| 3 | //#---------------------------------------------------------------------------
|
|---|
| 4 | //# Copyright (C) 2004
|
|---|
| 5 | //# 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 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 | //#---------------------------------------------------------------------------
|
|---|
| 31 | #ifndef SDREADER_H
|
|---|
| 32 | #define SDREADER_H
|
|---|
| 33 |
|
|---|
| 34 | #include <vector>
|
|---|
| 35 | #include <string>
|
|---|
| 36 |
|
|---|
| 37 | #include <casa/aips.h>
|
|---|
| 38 | #include <casa/iostream.h>
|
|---|
| 39 | #include <casa/Utilities/CountedPtr.h>
|
|---|
| 40 | #include <casa/BasicSL/String.h>
|
|---|
| 41 | #include <casa/Arrays/Vector.h>
|
|---|
| 42 |
|
|---|
| 43 | #include "SDMemTable.h"
|
|---|
| 44 | #include "SDContainer.h"
|
|---|
| 45 | #include "SDLog.h"
|
|---|
| 46 |
|
|---|
| 47 | class PKSreader;
|
|---|
| 48 |
|
|---|
| 49 | namespace asap {
|
|---|
| 50 |
|
|---|
| 51 | class SDReader : public SDLog {
|
|---|
| 52 | public:
|
|---|
| 53 | SDReader();
|
|---|
| 54 | SDReader(const std::string& filename,
|
|---|
| 55 | int whichIF=-1, int whichBeam=-1);
|
|---|
| 56 | SDReader(casa::CountedPtr<SDMemTable> tbl);
|
|---|
| 57 | virtual ~SDReader();
|
|---|
| 58 |
|
|---|
| 59 | void open(const std::string& filename,
|
|---|
| 60 | int whichIF=-1,
|
|---|
| 61 | int whichBeam=-1);
|
|---|
| 62 | void close();
|
|---|
| 63 | int read(const std::vector<int>& seq);
|
|---|
| 64 |
|
|---|
| 65 | casa::CountedPtr<SDMemTable> getTable() const { return table_;}
|
|---|
| 66 |
|
|---|
| 67 | void reset();
|
|---|
| 68 |
|
|---|
| 69 | std::vector<int> pseudoHeader() const {
|
|---|
| 70 | std::vector<int> v;
|
|---|
| 71 | v.push_back(nBeam_);v.push_back(nIF_);
|
|---|
| 72 | v.push_back(nPol_);v.push_back(nChan_);
|
|---|
| 73 | return v;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | protected:
|
|---|
| 78 |
|
|---|
| 79 | private:
|
|---|
| 80 | casa::Int nBeam_,nIF_,nPol_,nChan_;
|
|---|
| 81 | PKSreader* reader_;
|
|---|
| 82 | SDHeader* header_;
|
|---|
| 83 | SDFrequencyTable* frequencies_;
|
|---|
| 84 | casa::CountedPtr<SDMemTable> table_;
|
|---|
| 85 | casa::String filename_;
|
|---|
| 86 | casa::uInt cursor_;
|
|---|
| 87 | casa::Double timestamp_;
|
|---|
| 88 | casa::uInt beamOffset_, ifOffset_;
|
|---|
| 89 | casa::Bool haveXPol_;
|
|---|
| 90 | };
|
|---|
| 91 |
|
|---|
| 92 | }// namespace
|
|---|
| 93 | #endif
|
|---|