source: trunk/src/SDMemTableWrapper.h@ 117

Last change on this file since 117 was 105, checked in by mar637, 20 years ago

added set/getCoordInfo, reworked summary, added columns for azimuth,elevation,parangle,refbeam,fieldname,tcal,tcaltime
modified getabscissa, added getAbscissaString
added doppler, frequency frame an unit conversion via columns

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
RevLine 
[2]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//#---------------------------------------------------------------------------
[80]31#ifndef _SDMEMTABLEWRAPPER_H
32#define _SDMEMTABLEWRAPPER_H
[2]33
34#include <vector>
35#include <string>
36
37#include "SDMemTable.h"
38
[83]39namespace asap {
[2]40
41class SDMemTableWrapper {
42
43public:
[90]44 SDMemTableWrapper(const std::string& name) :
[2]45 table_(new SDMemTable(name)) {;}
[90]46 SDMemTableWrapper() :
[18]47 table_(new SDMemTable()) {;}
[90]48
[2]49 SDMemTableWrapper(CountedPtr<SDMemTable> cp) : table_(cp) {;}
[90]50 //SDMemTableWrapper(SDMemTable* sdmt) : table_(sdmt) {;}
51 SDMemTableWrapper(const SDMemTableWrapper& mt) :
52 table_(mt.getCP()) {;}
53
[80]54 SDMemTableWrapper(const SDMemTableWrapper& mt, const std::string& expr) :
55 table_(new SDMemTable(mt.getCP()->table(), expr)) {;}
[90]56
57 SDMemTableWrapper copy() {
58 //CountedPtr<SDMemTable> cp = new SDMemTable(*this, False);
59 return SDMemTableWrapper(new SDMemTable(*(this->getCP()), False));
60 }
61
[2]62 SDMemTableWrapper getScan(int scan) {
[80]63 String cond("SELECT * from $1 WHERE SCANID == ");
64 cond += String::toString(scan);
65 return SDMemTableWrapper(*this, cond);
[2]66 }
[80]67
68 SDMemTableWrapper getSource(const std::string& source) {
69 String cond("SELECT * from $1 WHERE SRCNAME == '");
70 cond += source;cond += "'";
71 return SDMemTableWrapper(*this, cond);
72 }
73
[51]74 std::vector<float> getSpectrum(int whichRow=0) const {
[2]75 return table_->getSpectrum(whichRow);
76 }
[41]77
[105]78 std::vector<double> getAbscissa(int whichRow=0) const {
79 return table_->getAbscissa(whichRow);
[41]80 }
[105]81 std::string getAbscissaString(int whichRow=0) const {
82 return table_->getAbscissaString(whichRow);
83 }
[41]84
[51]85 float getTsys(int whichRow=0) {return table_->getTsys(whichRow);}
86 std::string getTime(int whichRow=0) {return table_->getTime(whichRow);}
[2]87
[90]88 std::vector<bool> getMask(int whichRow=0) const {
89 return table_->getMask(whichRow);
[16]90 }
[90]91 bool setMask(const std::vector<int> mvals) const {
92 return table_->setMask(mvals);
93 }
[2]94
[90]95 void flag(int whichRow=-1) {
96 table_->flag(whichRow);
97 }
[51]98 std::string getSourceName(int whichRow=0) {
[2]99 return table_->getSourceName(whichRow);
100 }
101
[90]102 void setSpectrum(std::vector<float> spectrum, int whichRow=0) {
103 table_->setSpectrum(spectrum, whichRow);
104 }
105
[2]106 bool setIF(int whichIF=0) {return table_->setIF(whichIF);}
107 bool setBeam(int whichBeam=0) {return table_->setBeam(whichBeam);}
[90]108 bool setPol(int whichPol=0) {return table_->setPol(whichPol);}
[2]109
110 int getIF() {return table_->getIF();}
111 int getBeam() {return table_->getBeam();}
[90]112 int getPol() {return table_->getPol();}
[2]113
[18]114 int nIF() {return table_->nIF();}
115 int nBeam() {return table_->nBeam();}
[90]116 int nPol() {return table_->nPol();}
117 int nChan() {return table_->nChan();}
118 int nScan() {return table_->nScan();}
119 int nRow() {return table_->nRow();}
[2]120
121 //sets the mask
122 bool setChannels(const std::vector<int>& whichChans) {
[90]123 return setChannels(whichChans);
[2]124 }
125 void makePersistent(const std::string& fname) {
126 table_->makePersistent(fname);
127 }
[90]128
129 void setRestFreqs(std::vector<double> freqs, const std::string& theunit) {
130 table_->setRestFreqs(freqs, theunit);
131 }
[105]132 void setCoordInfo(std::vector<string> theinfo) {
133 table_->setCoordInfo(theinfo);
134 }
135 std::vector<string> getCoordInfo() const {
136 return table_->getCoordInfo();
137 }
[90]138
[2]139 CountedPtr<SDMemTable> getCP() const {return table_;}
[90]140 std::string summary() { return table_->summary(); }
141
[2]142private:
143 CountedPtr<SDMemTable> table_;
144};
145
146} // namespace
147#endif
Note: See TracBrowser for help on using the repository browser.