source: branches/newfiller/src/FillerBase.h @ 1786

Last change on this file since 1786 was 1786, checked in by Malte Marquarding, 14 years ago

Added Wrapper and python binding for Filler

File size: 3.3 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// AIPS++
30#include <casa/aips.h>
31#include <casa/Utilities/CountedPtr.h>
32#include <casa/Arrays/Vector.h>
33#include <tables/Tables/TableRow.h>
34#include "Scantable.h"
35
36namespace asap
37{
38
39class FillerBase
40{
41  public:
42    explicit FillerBase(casa::CountedPtr<Scantable> stable);
43    virtual ~FillerBase();
44
45//    virtual bool open(const std::string& filename, const Record& rec)=0;
46    virtual bool open(const std::string& filename)=0;
47    virtual void fill() = 0;
48    virtual void close() = 0;
49
50    void setReferenceRegex(const std::string& rx) { referenceRx_ = rx; }
51
52
53  protected:
54
55    casa::CountedPtr<Scantable> getTable();
56    void commitRow();
57    virtual void setHeader(const STHeader& header);
58    virtual void setSpectrum(const casa::Vector<casa::Float>& spectrum,
59                             const casa::Vector<casa::uChar>& flags) ;
60    virtual void setIndex(casa::uInt scanno, casa::uInt cycleno,
61                          casa::uInt ifno, casa::uInt polno,
62                          casa::uInt beamno=0);
63    virtual void setFrequency(casa::Double refpix, casa::Double refval,
64                              casa::Double incr);
65    virtual void setMolecule(const casa::Vector<casa::Double>& restfreq);
66    virtual void setDirection(const casa::Vector<casa::Double>& dir,
67                              casa::Float az=0.0f, casa::Float el=0.0f);
68
69    virtual void setFocus(casa::Float pa=0.0f, casa::Float faxis=0.0f,
70                          casa::Float ftan=0.0f, casa::Float frot=0.0f);
71    virtual void setTime(casa::Double mjd, casa::Double integration);
72    virtual void setWeather(casa::Float temperature=0.0f,
73                            casa::Float pressure=0.0f,
74                            casa::Float humidity=0.0f,
75                            casa::Float windspeed=0.0f,
76                            casa::Float windaz=0.0f);
77    virtual void setTcal(const casa::String& caltime="",
78                         const casa::Vector<casa::Float>& tcal=casa::Vector<casa::Float>());
79    virtual void setScanRate(const casa::Vector<casa::Double>& srate=casa::Vector<casa::Double>());
80    virtual void setReferenceBeam(casa::Int beamno=-1);
81    virtual void setSource(const std::string& name, casa::Int type,
82                           const std::string& fieldname="",
83                           const casa::Vector<casa::Double>& dir=casa::Vector<casa::Double>(),
84                           const casa::Vector<casa::Double>& propermot=casa::Vector<casa::Double>(),
85                           casa::Double velocity=0.0);
86
87  private:
88
89    casa::CountedPtr< Scantable > table_;
90    casa::String referenceRx_;
91
92    casa::TableRow row_;
93};
94
95
96};
97#endif
Note: See TracBrowser for help on using the repository browser.