DP3
ParmMap.h
Go to the documentation of this file.
1 // ParmMap.h: A map of parameter name to value set
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_PARMDB_PARMMAP_H
11 #define LOFAR_PARMDB_PARMMAP_H
12 
13 #include "ParmValue.h"
14 
15 #include <map>
16 
17 namespace dp3 {
18 namespace parmdb {
19 
20 class ParmDB;
21 
24 
26 
30 class ParmMap {
31  public:
33  ParmMap() {}
34 
36  void define(const std::string& name, const ParmValueSet& pset) {
37  itsValueSets[name] = pset;
38  }
39 
41  bool empty() const { return itsValueSets.empty(); }
42 
44  unsigned int size() const { return itsValueSets.size(); }
45 
48  const ParmValueSet& operator[](const std::string& name) const;
49 
52  typedef std::map<std::string, ParmValueSet>::iterator iterator;
53  typedef std::map<std::string, ParmValueSet>::const_iterator const_iterator;
54  typedef std::map<std::string, ParmValueSet>::value_type valueType;
55  iterator begin() { return itsValueSets.begin(); }
56  const_iterator begin() const { return itsValueSets.begin(); }
57  iterator end() { return itsValueSets.end(); }
58  const_iterator end() const { return itsValueSets.end(); }
59  iterator find(const std::string& name) { return itsValueSets.find(name); }
60  const_iterator find(const std::string& name) const {
61  return itsValueSets.find(name);
62  }
64 
66  void clear() { itsValueSets.clear(); }
67 
68  private:
71  ParmMap(const ParmMap&);
72  ParmMap& operator=(const ParmMap&);
74 
75  std::map<std::string, ParmValueSet> itsValueSets;
76 };
77 
79 
80 } // namespace parmdb
81 } // namespace dp3
82 
83 #endif
A class containing the values of a parameter.
A map of parameter name to value set.
Definition: ParmMap.h:30
iterator find(const std::string &name)
Definition: ParmMap.h:59
std::map< std::string, ParmValueSet >::iterator iterator
Definition: ParmMap.h:52
std::map< std::string, ParmValueSet >::const_iterator const_iterator
Definition: ParmMap.h:53
void clear()
Clear the map.
Definition: ParmMap.h:66
ParmMap()
Set up a map for the given domain in the ParmDB.
Definition: ParmMap.h:33
const_iterator begin() const
Definition: ParmMap.h:56
unsigned int size() const
Return the size of the map.
Definition: ParmMap.h:44
const_iterator end() const
Definition: ParmMap.h:58
bool empty() const
Is the map empty?
Definition: ParmMap.h:41
iterator end()
Definition: ParmMap.h:57
const_iterator find(const std::string &name) const
Definition: ParmMap.h:60
std::map< std::string, ParmValueSet >::value_type valueType
Definition: ParmMap.h:54
const ParmValueSet & operator[](const std::string &name) const
iterator begin()
Definition: ParmMap.h:55
void define(const std::string &name, const ParmValueSet &pset)
Add or replace a ParmValueSet.
Definition: ParmMap.h:36
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