DP3
VdsPartDesc.h
Go to the documentation of this file.
1 // VdsPartDesc.h: Description of a visibility data set or part thereof
2 //
3 // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy)
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 
9 
10 #ifndef LOFAR_LMWCOMMON_VDSPARTDESC_H
11 #define LOFAR_LMWCOMMON_VDSPARTDESC_H
12 
13 #include "ParameterSet.h"
14 
15 #include "blob/BlobOStream.h"
16 #include "blob/BlobIStream.h"
17 
18 #include <string>
19 #include <vector>
20 #include <iosfwd>
21 
22 namespace dp3 {
23 namespace common {
24 
27 
33 //
36 //
38 
39 class VdsPartDesc {
40  public:
42  VdsPartDesc() : itsStartTime(0), itsEndTime(1), itsStepTime(1) {}
43 
45  explicit VdsPartDesc(const ParameterSet&);
46 
48  void setName(const std::string& name, const std::string& fileSys);
49 
51  void setFileName(const std::string& name) { itsFileName = name; }
52 
54  void setClusterDescName(const std::string& cdName) { itsCDescName = cdName; }
55 
57  void changeBaseName(const std::string& newBaseName);
58 
61  void setTimes(double startTime, double endTime, double stepTime,
62  const std::vector<double>& starts = std::vector<double>(),
63  const std::vector<double>& ends = std::vector<double>());
64 
67  void addBand(int nchan, double startFreq, double endFreq);
68  void addBand(int nchan, const std::vector<double>& startFreq,
69  const std::vector<double>& endFreq);
71 
74  void addParm(const std::string& key, const std::string& value) {
75  return itsParms.add(key, value);
76  }
77 
79  const ParameterSet& getParms() const { return itsParms; }
80 
82  void clearParms() { itsParms.clear(); }
83 
85  void write(std::ostream& os, const std::string& prefix) const;
86 
89  const std::string& getName() const { return itsName; }
90  const std::string& getFileName() const { return itsFileName; }
91  const std::string& getFileSys() const { return itsFileSys; }
92  const std::string& getClusterDescName() const { return itsCDescName; }
93  double getStartTime() const { return itsStartTime; }
94  double getEndTime() const { return itsEndTime; }
95  double getStepTime() const { return itsStepTime; }
96  const std::vector<double>& getStartTimes() const { return itsStartTimes; }
97  const std::vector<double>& getEndTimes() const { return itsEndTimes; }
98  int getNBand() const { return itsNChan.size(); }
99  const std::vector<int>& getNChan() const { return itsNChan; }
100  const std::vector<double>& getStartFreqs() const { return itsStartFreqs; }
101  const std::vector<double>& getEndFreqs() const { return itsEndFreqs; }
103 
109 
110  private:
111  std::string itsName;
112  std::string itsFileName;
113  std::string itsFileSys;
114  std::string itsCDescName;
115  double itsStartTime;
116  double itsEndTime;
117  double itsStepTime;
118  std::vector<double> itsStartTimes;
119  std::vector<double> itsEndTimes;
120  std::vector<int32_t> itsNChan;
121  std::vector<double> itsStartFreqs;
122  std::vector<double> itsEndFreqs;
123  ParameterSet itsParms;
124 };
125 
129  const VdsPartDesc& vpd) {
130  return vpd.toBlob(bs);
131 }
133  return vpd.fromBlob(bs);
134 }
136 
137 } // namespace common
138 } // namespace dp3
139 
140 #endif
Input stream for a blob.
Definition: BlobIStream.h:43
Output stream for a blob.
Definition: BlobOStream.h:40
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:31
void add(const std::string &aKey, const std::string &aValue)
Definition: ParameterSet.h:431
void clear()
Clear the set.
Definition: ParameterSet.h:387
Description of a visibility data set or part thereof.
Definition: VdsPartDesc.h:39
void setFileName(const std::string &name)
Set the original file name.
Definition: VdsPartDesc.h:51
void addParm(const std::string &key, const std::string &value)
Definition: VdsPartDesc.h:74
VdsPartDesc()
Construct an empty object.
Definition: VdsPartDesc.h:42
const std::string & getFileSys() const
Definition: VdsPartDesc.h:91
const ParameterSet & getParms() const
Get access to the extra parameters.
Definition: VdsPartDesc.h:79
blob::BlobOStream & toBlob(blob::BlobOStream &) const
void write(std::ostream &os, const std::string &prefix) const
Write the VdsPartDesc object in parset format.
const std::string & getFileName() const
Definition: VdsPartDesc.h:90
const std::vector< double > & getEndFreqs() const
Definition: VdsPartDesc.h:101
const std::string & getName() const
Definition: VdsPartDesc.h:89
blob::BlobIStream & fromBlob(blob::BlobIStream &)
void setTimes(double startTime, double endTime, double stepTime, const std::vector< double > &starts=std::vector< double >(), const std::vector< double > &ends=std::vector< double >())
const std::vector< double > & getStartFreqs() const
Definition: VdsPartDesc.h:100
void setClusterDescName(const std::string &cdName)
Set the name of the ClusterDesc file used.
Definition: VdsPartDesc.h:54
void changeBaseName(const std::string &newBaseName)
Change the base part of the name.
int getNBand() const
Definition: VdsPartDesc.h:98
double getEndTime() const
Definition: VdsPartDesc.h:94
void setName(const std::string &name, const std::string &fileSys)
Set VDS name and file system.
double getStepTime() const
Definition: VdsPartDesc.h:95
void clearParms()
Clear the extra parameters.
Definition: VdsPartDesc.h:82
const std::vector< double > & getStartTimes() const
Definition: VdsPartDesc.h:96
double getStartTime() const
Definition: VdsPartDesc.h:93
VdsPartDesc(const ParameterSet &)
Construct from the given parameterset.
void addBand(int nchan, double startFreq, double endFreq)
const std::vector< int > & getNChan() const
Definition: VdsPartDesc.h:99
void addBand(int nchan, const std::vector< double > &startFreq, const std::vector< double > &endFreq)
const std::vector< double > & getEndTimes() const
Definition: VdsPartDesc.h:97
const std::string & getClusterDescName() const
Definition: VdsPartDesc.h:92
std::ostream & operator<<(std::ostream &os, const KVpair &kv)
blob::BlobIStream & operator>>(blob::BlobIStream &, ParameterSet &)
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53