source: trunk/src/FillerBase.h@ 2853

Last change on this file since 2853 was 2289, checked in by ShinnosukeKawakami, 13 years ago

merged parallel branch to trunk

File size: 4.2 KB
Line 
1//
2// C++ Interface: FillerBase
3//
4// Description:
5//
6// This class is the Base class for all data fillers.
7// The derived filler needs to implement
8// open()
9// close()
10// fill()
11//
12// The fill() method usually iterates over the source data and calls
13// the setXYZ() methods for. After all the data for a row has been set via
14// these methods, the fill() method needs to call commitRow() to write the
15// data to the scantable.
16// All arguments which are defaulted in the setXYZ() methods are optional. All
17// others should be set explicitly.
18//
19// Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2010
20//
21// Copyright: See COPYING file that comes with this distribution
22//
23//
24#ifndef ASAPFILLERBASE_H
25#define ASAPFILLERBASE_H
26
27// STL
28#include <string>
29#include <vector>
30// AIPS++
31#include <casa/aips.h>
32#include <casa/Utilities/CountedPtr.h>
33#include <casa/Arrays/Vector.h>
34#include <tables/Tables/TableRow.h>
35#include "Scantable.h"
36
37namespace asap
38{
39
40class FillerBase
41{
42 public:
43 explicit FillerBase(casa::CountedPtr<Scantable> stable);
44 virtual ~FillerBase() {;}
45
46 virtual bool open(const std::string& filename, const casa::Record& rec) = 0;
47 // virtual bool open(const std::string& filename) = 0;
48 virtual void fill() = 0;
49 virtual void close() = 0;
50
51 void setReferenceRegex(const std::string& rx) { referenceRx_ = rx; }
52 std::string getReferenceRegex() { return referenceRx_; }
53
54 protected:
55
56 void commitRow();
57 void setHeader(const STHeader& header);
58 void setSpectrum(const casa::Vector<casa::Float>& spectrum,
59 const casa::Vector<casa::uChar>& flags,
60 const casa::Vector<casa::Float>& tsys);
61 void setFlagrow(casa::uInt flag);
62 void setOpacity(casa::Float opacity=0.0f);
63 void setIndex(casa::uInt scanno, casa::uInt cycleno,
64 casa::uInt ifno, casa::uInt polno,
65 casa::uInt beamno=0);
66 void setFrequency(casa::Double refpix, casa::Double refval,
67 casa::Double incr);
68 void setMolecule(const casa::Vector<casa::Double>& restfreq);
69 void setDirection(const casa::Vector<casa::Double>& dir,
70 casa::Float az=0.0f, casa::Float el=0.0f);
71
72 void setFocus(casa::Float pa=0.0f, casa::Float faxis=0.0f,
73 casa::Float ftan=0.0f, casa::Float frot=0.0f);
74 void setTime(casa::Double mjd, casa::Double integration);
75 void setWeather(casa::Float temperature=0.0f,
76 casa::Float pressure=0.0f,
77 casa::Float humidity=0.0f,
78 casa::Float windspeed=0.0f,
79 casa::Float windaz=0.0f);
80 void setWeather2(casa::Float temperature=0.0f,
81 casa::Float pressure=0.0f,
82 casa::Float humidity=0.0f,
83 casa::Float windspeed=0.0f,
84 casa::Float windaz=0.0f);
85 void setTcal(const casa::String& caltime="",
86 const casa::Vector<casa::Float>& tcal=casa::Vector<casa::Float>());
87 void setTcal2(const casa::String& caltime="",
88 const casa::Vector<casa::Float>& tcal=casa::Vector<casa::Float>());
89 void setScanRate(const casa::Vector<casa::Double>& srate=casa::Vector<casa::Double>());
90 void setReferenceBeam(casa::Int beamno=-1);
91 void setSource(const std::string& name, casa::Int type,
92 const std::string& fieldname="",
93 const casa::Vector<casa::Double>& dir=casa::Vector<casa::Double>(),
94 const casa::Vector<casa::Double>& propermot=casa::Vector<casa::Double>(),
95 casa::Double velocity=0.0);
96
97 casa::CountedPtr< Scantable > table_;
98
99 private:
100
101 FillerBase();
102 FillerBase(const FillerBase&);
103 FillerBase& operator=(const FillerBase&);
104 casa::String referenceRx_;
105 casa::TableRow row_;
106
107 std::vector< casa::Vector<casa::Double> > mEntry_ ;
108 std::vector<casa::uInt> mIdx_ ;
109 std::vector< casa::Vector<casa::Double> > fEntry_ ;
110 std::vector<casa::uInt> fIdx_ ;
111 std::vector< casa::Vector<casa::Float> > wEntry_ ;
112 std::vector<casa::uInt> wIdx_ ;
113};
114
115
116};
117#endif
Note: See TracBrowser for help on using the repository browser.