source: trunk/src/SDMemTable.h @ 19

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

Added documentation.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1//#---------------------------------------------------------------------------
2//# SDMemTable.h: A MemoryTable container for single dish integrations
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 _SDMEMTABLE_H_
32#define _SDMEMTABLE_H_
33
34// STL
35#include <string>
36#include <vector>
37// AIPS++
38#include <aips/aips.h>
39#include <aips/Utilities/String.h>
40#include <aips/Tables/Table.h>
41#include <aips/Arrays/MaskedArray.h>
42
43namespace atnf_sd {
44
45class SDContainer;
46class SDHeader;
47class SDFrequencyTable;
48
49
50class SDMemTable {
51public:
52  // create a new (empty) SDMemTable
53  SDMemTable();
54  // create a SDMemTable from a )aips++) table on disk
55  SDMemTable(const std::string& name);
56
57  // Copy Construct a SDMemTable, if clear==True only header and
58  // skeleton are copied, otherwise the whole table is copied.
59  SDMemTable(const SDMemTable& other, Bool clear=False);
60
61  // Copy Construct a SDMemTable, give a scanid constraint
62  // see also getScan()
63  SDMemTable(const Table& tab, Int scanID);
64
65  virtual ~SDMemTable();
66
67  // put data from meta conatiner into the table
68  virtual bool putSDContainer(const SDContainer& sdc);
69  virtual bool putSDHeader(const SDHeader& sdh);
70  virtual bool putSDFreqTable(const SDFrequencyTable& sdft) {;}
71 
72  // get spectrum,mask and tsys for the given row, at the selected
73  // cursor
74  virtual std::vector<float> getSpectrum(Int whichRow) const;
75  virtual std::vector<bool> getMask(Int whichRow) const;
76  virtual Float getTsys(Int whichRow) const;
77
78  // get info fro current row
79  virtual Double getTime(Int whichRow) const ;
80  virtual std::string getSourceName(Int whichRow) const;
81 
82  // set the current value
83  virtual bool setIF(Int whichIF=0);
84  virtual bool setBeam(Int whichBeam=0);
85  virtual bool setPol(Int whichPol=0);   
86  //sets the user mask
87  virtual bool setMask(const std::vector<int>& whichChans);
88 
89  // return the currently selected values
90  virtual Int getIF() { return IFSel_; }
91  virtual Int getBeam() { return beamSel_; }
92  virtual Int getPol() { return polSel_; }   
93 
94  // print a summary to stdout
95  virtual void summary() const;
96 
97  // the (irrelevant) name
98  std::string name() const;
99
100  // write to disk as aips++ table
101  void makePersistent(const std::string& filename);
102
103  // get a new SDMemTable containg all rows with the same give SCANID
104  SDMemTable getScan(Int scanID);
105
106  const TableRecord& getHeader() const {;}
107  // get a handle to the "raw" aips++ table
108  const Table& table() { return table_; }
109
110  // return the number of values
111  Int nBeam() const;
112  Int nIF() const;
113  Int nPol() const;
114  Int nChan() const;
115
116  // return a row as a Masked array, internally converting uChar flags
117  // to bool mask
118  MaskedArray<Float> rowAsMaskedArray(uInt whichRow,
119                                      Bool useSelection = False);
120
121private:
122  // set up tabel structure
123  void setup();
124  // the current cursor into the array
125  Int IFSel_,beamSel_,polSel_;
126  std::vector<bool> chanMask_; 
127  String name_;
128  // the unerlying memory table
129  Table table_;
130};
131
132}// namespace
133#endif
Note: See TracBrowser for help on using the repository browser.