DP3
ParmFacadeLocal.h
Go to the documentation of this file.
1 // ParmFacadeLocal.h: Data access the parameter database
2 //
3 // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy)
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 
6 #ifndef LOFAR_PARMDB_PARMFACADELOCAL_H
7 #define LOFAR_PARMDB_PARMFACADELOCAL_H
8 
9 #include "ParmFacadeRep.h"
10 #include "ParmDB.h"
11 
12 #include <casacore/casa/Containers/Record.h>
13 #include <casacore/casa/Arrays/Vector.h>
14 
15 namespace dp3 {
16 namespace parmdb {
17 
20 
22 
40 
42  public:
44  ParmFacadeLocal(const std::string& tableName, bool create = false);
45 
47  ~ParmFacadeLocal() override;
48 
53  std::vector<double> getRange(
54  const std::string& parmNamePattern) const override;
55 
58  std::vector<std::string> getNames(const std::string& parmNamePattern,
59  bool includeDefaults) const override;
60 
63  std::vector<std::string> getDefNames(
64  const std::string& parmNamePattern) const override;
65 
67  casacore::Record getDefValues(
68  const std::string& parmNamePattern) const override;
69 
71  void addDefValues(const casacore::Record&, bool check) override;
72 
74  void deleteDefValues(const std::string& parmNamePattern) override;
75 
79  casacore::Record getValues(const std::string& parmNamePattern, double freqv1,
80  double freqv2, double freqStep, double timev1,
81  double timev2, double timeStep, bool asStartEnd,
82  bool includeDefaults) override;
83 
87  casacore::Record getValues(const std::string& parmNamePattern,
88  const std::vector<double>& freqv1,
89  const std::vector<double>& freqv2,
90  const std::vector<double>& timev1,
91  const std::vector<double>& timev2, bool asStartEnd,
92  bool includeDefaults) override;
93 
100  casacore::Record getValuesGrid(const std::string& parmNamePattern,
101  double freqv1, double freqv2, double timev1,
102  double timev2, bool asStartEnd) override;
103 
105  casacore::Record getCoeff(const std::string& parmNamePattern, double freqv1,
106  double freqv2, double timev1, double timev2,
107  bool asStartEnd) override;
108 
110  void clearTables() override;
111 
113  void flush(bool fsync) override;
114 
119  void lock(bool lockForWrite) override;
120  void unlock() override;
122 
124  std::vector<double> getDefaultSteps() const override;
125 
127  void setDefaultSteps(const std::vector<double>&) override;
128 
130  void addValues(const casacore::Record& rec) override;
131 
133  void deleteValues(const std::string& parmNamePattern, double freqv1,
134  double freqv2, double timev1, double timev2,
135  bool asStartEnd) override;
136 
137  private:
139  casacore::Record doGetValues(const std::string& parmNamePattern,
140  const Grid& predictGrid, bool includeDefaults);
141 
144  Grid getGrid(const ParmValueSet& valueSet, const Box& domain);
145 
147  casacore::Record getFunkletCoeff(const ParmValueSet& pvset);
148 
150  void addDefValue(const std::string& parmName, const casacore::Record& value,
151  bool check);
152 
154  void addValue(const std::string& parmName, const casacore::Record& value);
155 
157  Grid record2Grid(const casacore::Record& rec) const;
158 
160  Axis::ShPtr makeAxis(const casacore::Vector<double>& centers,
161  const casacore::Vector<double>& widths,
162  unsigned int n) const;
163 
165  int getType(const std::string& str) const;
166 
167  ParmDB itsPDB;
168 };
169 
171 
172 } // namespace parmdb
173 } // namespace dp3
174 
175 #endif
Base class for a table holding parameters.
std::shared_ptr< Axis > ShPtr
Define a shared_ptr for this class.
Definition: Axis.h:32
Class representing a 2-dim box.
Definition: Box.h:36
The envelope class for a 2-D grid with regular or irregular axes. -.
Definition: Grid.h:83
Envelope class for a table holding parameters.
Definition: ParmDB.h:159
Data access the a local parameter database.
Definition: ParmFacadeLocal.h:41
void deleteValues(const std::string &parmNamePattern, double freqv1, double freqv2, double timev1, double timev2, bool asStartEnd) override
Delete the records for the given parameters and domain.
~ParmFacadeLocal() override
The destructor disconnects.
void setDefaultSteps(const std::vector< double > &) override
Set the default step values.
casacore::Record getDefValues(const std::string &parmNamePattern) const override
Get the default values of parameters matching the pattern.
std::vector< std::string > getDefNames(const std::string &parmNamePattern) const override
ParmFacadeLocal(const std::string &tableName, bool create=false)
Make a connection to a new or existing ParmTable.
void lock(bool lockForWrite) override
std::vector< std::string > getNames(const std::string &parmNamePattern, bool includeDefaults) const override
void addDefValues(const casacore::Record &, bool check) override
Add one or more default values.
casacore::Record getValues(const std::string &parmNamePattern, double freqv1, double freqv2, double freqStep, double timev1, double timev2, double timeStep, bool asStartEnd, bool includeDefaults) override
void flush(bool fsync) override
Flush the possible changes to disk.
std::vector< double > getDefaultSteps() const override
Get the default step values for the axes.
std::vector< double > getRange(const std::string &parmNamePattern) const override
void addValues(const casacore::Record &rec) override
Add the values for the given parameter names and domain.
void deleteDefValues(const std::string &parmNamePattern) override
Delete the default value records for the given parameters.
casacore::Record getCoeff(const std::string &parmNamePattern, double freqv1, double freqv2, double timev1, double timev2, bool asStartEnd) override
Get coefficients, errors, and domains they belong to.
casacore::Record getValuesGrid(const std::string &parmNamePattern, double freqv1, double freqv2, double timev1, double timev2, bool asStartEnd) override
casacore::Record getValues(const std::string &parmNamePattern, const std::vector< double > &freqv1, const std::vector< double > &freqv2, const std::vector< double > &timev1, const std::vector< double > &timev2, bool asStartEnd, bool includeDefaults) override
void clearTables() override
Clear the tables, thus remove all parameter values and default values.
Data access the parameter database.
Definition: ParmFacadeRep.h:38
A class holding information of multiple domains of a parameter. ParmValueSet holds the information of...
Definition: ParmValue.h:146
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53