source: trunk/src/SDMemTableWrapper.h@ 58

Last change on this file since 58 was 51, checked in by mmarquar, 20 years ago

Removed other Wrapper classes and put them into their own files.
Added/changed some wrappers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1//#---------------------------------------------------------------------------
2//# SDMemTableWrapper.h: Wrapper classes to use CountedPtr
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2004
5//# Malte Marquarding, 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 _SDMEMTABLEWRAPPER_H_
32#define _SDMEMTABLEWRAPPER_H_
33
34#include <vector>
35#include <string>
36
37#include "SDMemTable.h"
38
39namespace atnf_sd {
40
41class SDMemTableWrapper {
42
43public:
44 SDMemTableWrapper(const std::string& name) :
45 table_(new SDMemTable(name)) {;}
46 SDMemTableWrapper() :
47 table_(new SDMemTable()) {;}
48
49 SDMemTableWrapper(CountedPtr<SDMemTable> cp) : table_(cp) {;}
50 SDMemTableWrapper(SDMemTable* sdmt) : table_(sdmt) {;}
51
52 SDMemTableWrapper(const SDMemTableWrapper& mt, int scan) :
53 table_(new SDMemTable(mt.getCP()->table(), scan)) {;}
54
55 SDMemTableWrapper getScan(int scan) {
56 return SDMemTableWrapper(*this, scan);
57 }
58 std::vector<float> getSpectrum(int whichRow=0) const {
59 return table_->getSpectrum(whichRow);
60 }
61
62 std::vector<double> getAbscissa(int whichRow,
63 const std::string& unit = "GHz",
64 double restfreq=0.0) const {
65 return table_->getAbscissa(whichRow,unit,restfreq);
66 }
67
68 float getTsys(int whichRow=0) {return table_->getTsys(whichRow);}
69 std::string getTime(int whichRow=0) {return table_->getTime(whichRow);}
70
71 std::vector<bool> getMask(int whichRow=0) const {
72 return table_->getMask(whichRow);
73 }
74 bool setMask(const std::vector<int> mvals) const {
75 return table_->setMask(mvals);
76 }
77
78 std::string getSourceName(int whichRow=0) {
79 return table_->getSourceName(whichRow);
80 }
81
82 bool setIF(int whichIF=0) {return table_->setIF(whichIF);}
83 bool setBeam(int whichBeam=0) {return table_->setBeam(whichBeam);}
84 bool setPol(int whichPol=0) {return table_->setPol(whichPol);}
85
86 int getIF() {return table_->getIF();}
87 int getBeam() {return table_->getBeam();}
88 int getPol() {return table_->getPol();}
89
90 int nIF() {return table_->nIF();}
91 int nBeam() {return table_->nBeam();}
92 int nPol() {return table_->nPol();}
93 int nChan() {return table_->nChan();}
94 int nScans() {return table_->nScans();}
95
96 //sets the mask
97 bool setChannels(const std::vector<int>& whichChans) {
98 return setChannels(whichChans);
99 }
100 void makePersistent(const std::string& fname) {
101 table_->makePersistent(fname);
102 }
103 CountedPtr<SDMemTable> getCP() const {return table_;}
104 void summary() { table_->summary(); }
105
106private:
107 CountedPtr<SDMemTable> table_;
108};
109
110} // namespace
111#endif
Note: See TracBrowser for help on using the repository browser.